Add deprecated attribute to methods in roact-compat#8
Open
gaymeowing wants to merge 280 commits into
Open
Conversation
added 30 commits
July 26, 2021 10:05
* Add tests for expected functionality * Implement and add tests for initialized state singleton * Skipping test for deviation * Skip accessing state test for componentWillMount * Fixing tests that rely on nil state initialization * Removed unnecessary tests, fixed typos in headings * check for __DEV__ before warning * review updates, added __metatable * Update modules/react-reconciler/src/__tests__/ReactComponentLifeCycle.roblox.spec.lua * Update modules/react-reconciler/src/ReactFiberClassComponent.new.lua * Fixed error message * Added deviation comment, fixed test name * Export uninitialized state table for equality checks
Remember how we couldn't figure out why Roact 17 wasn't respecting frame time boundaries? Here's why: * We were using the 'naive' scheduler implementation that's enabled when certain browser functionality isn't present * We needed to switch to using an approximation of the browser-enabled logic * We needed to resolve a dastardly bug lurking in ReactFiberWorkLoop where we weren't properly resuming incomplete work
* While debugging test failures in social-libaries with React 17, I found opportunities for more actionable messages. * Align error output logic across files, which have not-quite duplicated logic upstream. I've made the same modification in my local reactjs checkout for testing and PR to their repo. Fix a few issues that came up in UIBlox stack traces. * Only use tostring() fallback on the table if it has the __tostring metamethod defined. This avoids the 'table: 0x1234abcd' as the component name by returning nil and allowing location-specific fallback names. * Throw when an invalid root is passed in, as its an unrecoverable scenario. Eliminate some jest-roblox workaround cruft. Adjust a type. * Adjust every mention of JSX literal in warnings to also mention Element, which generically helps point to another class of issues. Will propose upstream.
Closes LUAFDN-390. This moves the logic for bindings into the React project and re-implements refs on top of them. With this logic in place, values that are assigned as refs will also update dynamically when the reconciler subscribes to their value. I've added a couple of tests to demonstrate what sorts of use cases this feature addresses.
Upgrades to the newest Rotriever, which restores type exporting and works around behaviors in roblox-cli that were causing some files to not be typechecked or linted. Rotriever used to symlink path dependencies directly to their declared content_root. Now, we link to the root of the project and trust that the project files there will nest correctly. It appears that if roblox-cli analyze follows nested projects via symlinks, it loses track of the .robloxrc config and does not type check. This is why there are new lints; I'm not sure if this is the result of symlinks, nested projects, or some combination thereof. To work around it, I've added .robloxrc files to each of the individual projects. This surfaced a number of new lints, most of them valid. I've cleaned up the legitimate ones, and added workarounds for the rest.
…(#154) Ticket: https://jira.rbx.com/browse/LUAFDN-395 updater is a reserved name that is internal only so to discourage external usage and avoid potential conflicts, we've changed that to __updater. refs is a reserved name, as it is used for legacy stringrefs. However, some of our components set self.refs to something of their own, causing breaks and failures. To resolve this, we simply remove refs. It is a legacy feature that adds no additional functionality, so removing it does not have any impact on our codebase's capabilities or compatibility. We didn't use it anyway, and it isn't worth supporting if it brings up problems for no real gain.
* Add studio test * Build model and make spec.lua support run-in-roblox * Update to use roblox-actionscache * Edit the FFlag json * Run empty studio to finalize setup * Use cookie secret
Fixes a few issues that were tripping up UIBlox tests: Changes the signature of funcitonal setState to match expected (state, props) -> partialState Warns about lifecycle names only in DEV (to cut some noise) Applies lifecycle renaming to PureComponent in addition to Component Makes RoactCompat.mount a bit more comparable to old Roact behavior, may need some more nudges still (and needs tests!)
Remove an unhelpful warning, bump the version, pin older CLI until regression is fixed
Problem LUAFDN-419 In infinite-scroller, we noticed that child component keys that are tables (rather than numbers or strings) are stored as tables, causing some issues with references to those children. Solution In ReactChildFiber.new.lua, we convert table-type keys to strings and assign them as the child's new key.
setup CI benchmark script setup benchmarks on CI
LUAFDN-461 Fixes an issue where forwardRef objects did not allow fields to be assigned to them, which will break certain use cases in the wild.
Closes LUAFDN-477. This won't be as thorough with warning as before, but it should cut out a lot of noise that makes it hard to see other, more important dev warnings.
Increments version for a rotriever release
push gh-pages only on master add benchmarks to docs site benchmarks and docs deploy in single workflow
Calculate benchmarks data for each push on PRs. Compares benchmark results to master (instead of previous commit), and avoids retriggering lifecycles while still allowing checks to run and pass.
Update benchmark data.json to comply with the newest benchmarks
* Fix new true positive analysis warning. Submitted a similar PR upstream. * Eliminate unused dependencies to get rid of some 0% coverage in rotriever proxy files.
* Pass key to createChild, updateSlot, add test * Add fix for nested children arrays * Add benchmarks results for b018a4374ff037832d8817c5eecd9a866f937469 skip-push-benchmarks: true * Add benchmarks results for cf67e67847416a3efaf7ad1c48a198e9b322c149 skip-push-benchmarks: true * Add key to single element when changing from array * Add benchmarks results for 7b035d84334cbad245a57eb84dbc880f8fb5e9bb skip-push-benchmarks: true * Add deviation comments to tests * Add benchmarks results for 323aa7586104f0cb31715e4aa488c9e7d9b55c96 skip-push-benchmarks: true * Update Deviations.md * Add benchmarks results for 84a2b81f277f500076c83ad63d365e098a3d9c4d skip-push-benchmarks: true * Don't use expensive isArray, instead directly check if element before passing it newIdx * Add benchmarks results for d77ddcae5064aad786dd7a16a745cf16d8b3a481 skip-push-benchmarks: true
* LUAFDN-540 Limit pcalls in recursivelyCommitLayoutEffects * Add benchmarks results for cfaf6a261dbfcdf1302576111759edfdca95e9d2 skip-push-benchmarks: true * Lowered threshold to 180, added test to break things * Update dev mode and max run depth * Add benchmarks results for 9b17402a805c9c90daa6561a8529599ac138d139 skip-push-benchmarks: true * Fix whitespace issues in test * Add benchmarks results for 55488503ce63674a1a9158484b5a4b3073f7e15d skip-push-benchmarks: true
* Store should re-assign its event-handling methods in its constructor so that they can be called in isolation without reference to self * More minor fixes, mainly removing Map.new * Fix another round of require paths. Workspace is the local package's src directory. Packages is the local package's explicit dependencies as specified in the rotriver.toml. * Fix some warnings relating to keys not being found on the reconciler import. Reconciler is special, in that it returns a function that needs to be called with a HostConfig object. This is our runtime emulation of a bundle/compile-time injection that happens upstream. Talking with Paul, we need to make it so we can import data-only exports like ReactTypeOfMode, without the need for a host config. We'll figure it out next week, but we should be able to run store-test and some of the other self-contained unit tests in the meantime. * Expose ReactFiberFlags in ReactFiberReconciler * Renderer calls aren't instance calls * Introduce Agent type * Properly return exports for cache, even thought the module isn't used. Manually fix another stylua misformat bug. * First pass at a public interface for devtools-shared. Like the shared/ directory upstream, there's no explicit interface (yet).
…sages (#192) * Make ReactFiberComponentStack exception handling durable against all kinds of error shapes that could be thrown * export unstable_batchedUpdates to be consistent with other renderers. * export createTextInstance and throw an unimplemented error for clearer feedback when porting upstream tests. * Fix some of the string formatting issues lying in wait mentioned in the JIRA ticket. This functionality is already covered upstream by a test file we haven't ported yet, so port the relevant portions of that file. * Enable many newly ported upstream tests. * Review all console.error messages for bugs and issues. Found a number of issues and fixed them. Most of the bugs would have been found with the upstream createReactClassIntegration-test file, which we haven't ported yet. Saving that step for another ticket. * Review all the invariant messages, and fix a few issues found. Port an upstream test file over that would have covered things. Add some deviation and TODO comments. * Add missing upstream comments, remove some out-of-date deciation/FIXME comments. * Fix https links * Fix a very interesting bug that would have bit us deeply. This was partially due to the deviated logic around when we can check for 'ref.current', and that we weren't consistent about using hard errors around use of string refs.
* I could not figure out how to do the console spying, so I created a completely deviant `toLogDev` matcher. We should do a proper `spyOnDevAndProd` implementation in jest, which will likely need some intimacy with the `console` in LuauPolyfill. * The Suspense tests for DebugTracing aren't passing because we never get the `resolve` message. Files LUAFDN-564 to track that future work.
* change scheduler's work window
* Switch back to setTimeout skip-push-benchmarks: true
* Fix numerous wrong-code bugs in the initial react-devtools-shared and react-debug-tools translation
* Align upstream types and comments in react-devtools-shared and react-debug-tools. Fix all nonstrict and most strict analysis issues. Add nonstrict to robloxrc for both packages.
* Fix slightly misaligned types and some missing types (`any`) in react-reconciler and shared
* Move the `Dispatcher` type to Shared so it can be used without running into circular dependencies
* We actually get 'code is too complex to typecheck' warnings when adding `Dispatcher` type annotation in a key place. Add a FIXME comments and make it `Object` for now.
* Today I learned that a function returning void ('()') will not match a function type returning 'any'. It *will* match '...any', though.
* Format react-devtools-shared and react-debug-tools using StyLua. Update StyLua to run on these entire directories.
There are two steps we need to take: Switch to using task.delay Separate yield tracking from frame boundary tracking; decide dynamically when to delay vs. simply yielding This PR will track only step 1. I've created LUAFDN-603 for the second part.
Upgrades CI tools (selene was almost 4 years old)
Upgrades StyLua to support modern Luau features and fixes styles that broke because of the upgrade.
Implements core React Devtools functionality, with lots of outstanding issues and bugs. NOTE TO COMMUNITY: This isn't ready yet!! Please hold your horses!
Adds pcall around unprotected index in typeOf() from react-is to prevent `strict()` wrapped tables from erroring.
Fixes nil exception when changing component props and state from DevTools inspector.
…ools (#445) Fixed element selection from DevTools not working. Closes two tickets in Jira.
…ve Heartbeat event. (#449) Closes (ISSUES HERE). https://roblox.atlassian.net/browse/APPEXP-2466 When some codes yields to a new frame, the existing debug.profilebegin will be cleaned up, so on the react profiling side, we should also reset the state. Before it is using the RenderStepped, it appears too late for some cases, the heartbeat solved this issue.
…n't sync over components and other state (#447) Sets up the `_G.__REACT_DEVTOOLS_ATTACH__` hook so that the React renderer starts collecting data for DevTools immediately, before DevTools actually connects. This should help solve a few use cases (such as profiling on start), but primarily it fixes the bug where launching DevTools after the client starts doesn't sync state up properly.
… set personality to x86_64: Operation not permitted` (#453) ## Problem while working on making benchmarks more stable in Foundation, noticed we have a few things broken in roact-alignment ## Solution - Passing `--privileged` as suggested [here](https://roblox.slack.com/archives/C0112GAH0A1/p1752275111589509?thread_ts=1752272650.441599&cid=C0112GAH0A1) to fix setarch permissions ## Testing before `setarch: failed to set personality to x86_64: Operation not permitted` ([logs](https://github.com/Roblox/roact-alignment/actions/runs/16327087530/job/46119943628)) with `--privileged` ([logs](https://github.com/Roblox/roact-alignment/actions/runs/16275837938/job/45954396993?pr=453)) ``` Run ./bin/run-with-cachegrind.sh ./robloxdev-cli bin/run-first-render-benchmark.lua "FirstRenderCold" 1 | tee -a run-first-render-benchmark-output.txt --597-- warning: L3 cache found, using its data for the LL simulation. --597-- warning: specified LL cache: line_size 64 assoc 11 total_size 25,952,256 --597-- warning: simulated LL cache: line_size 64 assoc 12 total_size 25,165,824 [598:598:20250714,192142.632134:WARNING close_multiple.cc:67] close: Bad file descriptor (9) [598:598:20250714,192142.647548:WARNING close_multiple.cc:67] close: Bad file descriptor (9) [598:598:20250714,192142.648049:WARNING close_multiple.cc:67] close: Bad file descriptor (9) [598:598:20250714,192142.648375:WARNING close_multiple.cc:67] close: Bad file descriptor (9) [598:598:20250714,192142.648677:WARNING close_multiple.cc:67] close: Bad file descriptor (9) [598:598:20250714,192142.648966:WARNING close_multiple.cc:67] close: Bad file descriptor (9) ./bin/run-with-cachegrind.sh: line 56: bc: command not found ``` after using `awk` ``` MountDeepTreeCGCold#TotalInstructionsExecuted x 1115357635.0000000000 executions ±0% (1 runs sampled)(roblox-cli version 0.682.0.682053849c0feadbc2a121e2464839b021c22701a0b1e7f) MountDeepTreeCGCold#L1_InstrReadCacheMisses x 0.0035760000 misses/op ±0% (1 runs sampled)(roblox-cli version 0.682.0.682053849c0feadbc2a121e2464839b021c22701a0b1e7f) MountDeepTreeCGCold#LL_InstrReadCacheMisses x 0.0001560000 misses/op ±0% (1 runs sampled)(roblox-cli version 0.682.0.682053849c0feadbc2a121e2464839b021c22701a0b1e7f) MountDeepTreeCGCold#TotalMemoryReads x 269488858.0000000000 reads ±0% (1 runs sampled)(roblox-cli version 0.682.0.682053849c0feadbc2a121e2464839b021c22701a0b1e7f) MountDeepTreeCGCold#L1_DataReadCacheMisses x 0.0289310000 misses/op ±0% (1 runs sampled)(roblox-cli version 0.682.0.682053849c0feadbc2a121e2464839b021c22701a0b1e7f) MountDeepTreeCGCold#LL_DataReadCacheMisses x 0.0015050000 misses/op ±0% (1 runs sampled)(roblox-cli version 0.682.0.682053849c0feadbc2a121e2464839b021c22701a0b1e7f) MountDeepTreeCGCold#TotalMemoryWrites x 149201992.0000000000 writes ±0% (1 runs sampled)(roblox-cli version 0.682.0.682053849c0feadbc2a121e2464839b021c22701a0b1e7f) MountDeepTreeCGCold#L1_DataWriteCacheMisses x 0.0170560000 misses/op ±0% (1 runs sampled)(roblox-cli version 0.682.0.682053849c0feadbc2a121e2464839b021c22701a0b1e7f) MountDeepTreeCGCold#LL_DataWriteCacheMisses x 0.0090970000 misses/op ±0% (1 runs sampled)(roblox-cli version 0.682.0.682053849c0feadbc2a121e2464839b021c22701a0b1e7f) ```
Ports ReactFreshRuntime.lua and the remainder of ReactFiberHotReloading.new.lua to support HMR. ---------
Closes [UIBLOX-2787](https://roblox.atlassian.net/browse/UIBLOX-2787). Implements a small example app to make testing DevTools and other React features easier. The example app itself is taken from the HMR repo.
### Why are the changes being made? Closes [UIBLOX-2778](https://roblox.atlassian.net/browse/UIBLOX-2778). Fixes a few bugs with native element highlights in Devtools: - We now make sure that an instance is a GuiBase2d before trying to read UI properties - OverlayTip now accounts for a global ZIndex - Focusing the viewport no longer ends selection (e.g. clicking from devtools into studio) - Overlapping highlight rects no longer stack their transparency
… (#461) ### Why are the changes being made? Closes [UIBLOX-2757](https://roblox.atlassian.net/browse/UIBLOX-2757). Adds check for touch events when doing element selection in devtools. This adds minimal support for the mobile emulator, but the UX still isn't ideal since you have to hold your pointer down to preview the selection. Unfortunately, I don't think there's a way around this since input events only fire in the emulator when the pointer is down. This shouldn't merge until after #460 because I need to apply the new check to the other input event that PR introduces. ### What changes are being made? - Adds `isInputValid` utility to React DevTools Highlighter to support touch input for Roblox Studio's mobile emulator and updates input handling accordingly. --- - [x] AI-assisted summary reviewed and verified by author
### Why are the changes being made? Closes [UIBLOX-2770](https://roblox.atlassian.net/browse/UIBLOX-2770). ### What changes are being made? - Fixes root name display in React DevTools by initializing flags before importing `ReactDevtoolsCore`, replacing `mountedRoots` table operations with `Set` methods, and using fiber key for root name resolution. --- - [x] AI-assisted summary reviewed and verified by author ---------
### Why are the changes being made? Release version 17.3.2 ### What changes are being made? - Updates version in `rotriever.toml` from `17.3.1` to `17.3.2` for new release preparation --- - [x] AI-assisted summary reviewed and verified by author
### Why are the changes being made? Closes [UIBLOX-1997](https://roblox.atlassian.net/browse/UIBLOX-1997). *Put your pull request body here!* Checklist before submitting: * [ ] Added/updated relevant tests * [ ] Added/updated documentation ### What changes are being made? - Introduces `ReactGlobals` package to replace `_G` for React's global variables, ensuring scoped and type-safe global state per React instance. - Refactors all modules and tests to use `ReactGlobals`, updates dependencies to include the new package, and maintains backward compatibility. - Adds documentation for `ReactGlobals` and resolves cross-plugin state leakage issue described in UIBLOX-1997. --- - [ ] AI-assisted summary reviewed and verified by author
Closes [UIBLOX-2900](https://roblox.atlassian.net/browse/UIBLOX-2900). Adds a `profileOnStart` option when connecting to DevTools. This makes the agent start profiling as soon as the DevTools hook is setup and initialized, before any tree is even mounted. This is a deviation from upstream, which doesn't expose a public API for starting the profiler immediately.
### Why are the changes being made? Add context about changes here. ### What changes are being made? - Updates `roact-alignment` to version `17.3.3` by modifying `ReactVersion.lua` and `rotriever.toml`. --- - [ ] AI-assisted summary reviewed and verified by author
### Why are the changes being made? Closes [UIBLOX-2937](https://roblox.atlassian.net/browse/UIBLOX-2937). Implements a new React Telemetry package for internal-only telemetry collection. This is currently only used for DevTools, but is designed to be easy to use in other applications later. ### What changes are being made? - Adds new `react-telemetry` module for internal telemetry reporting in React apps, including event logging for DevTools connections via `TelemetryService`. - Introduces feature flag `ReactTelemetryEnabled` to gate telemetry functionality and supports custom fields for event data. - Adds configuration and utility files (`.luaurc`, `.robloxrc`, `rotriever.toml`, README, `reportCounter`, `getCustomFields`) to structure and document the module. --- - [x] AI-assisted summary reviewed and verified by author
### Why are the changes being made? Closes [UIBLOX-3019](https://roblox.atlassian.net/browse/UIBLOX-3019). Ports the minimal amount of code from `react-devtools-timeline` required by the latest version of `react-devtools-shared`. This is just Luau types and a couple of constants, but could expand in the future. I considered just inlining these in devtools shared, but wanted to stay aligned with upstream. edit: I also apprantely updated styling for some example files. probably wanna keep that? ### What changes are being made? - Ports minimal subset of `react-devtools-timeline` to support latest `react-devtools-shared` by adding `constants.lua` and `types.lua` with upstream constants and types - Adds new module configuration files `.luaurc`, `.robloxrc`, `default.project.json`, and `rotriever.toml` for `react-devtools-timeline` - Updates example files for compatibility and formatting consistent with Roblox Luau environment --- - [ ] AI-assisted summary reviewed and verified by author
I got an error using hooks incorrectly, but all I saw was ``` invalid argument Roblox#4 to 'format' (string expected, got table) ------ Error caught by React ------ ReplicatedStorage.Packages._Index.ReactRoblox.ReactRoblox.client.roblox.RobloxComponentProps:242 function setInitialProperties ReplicatedStorage.Packages._Index.ReactRoblox.ReactRoblox.client.ReactRobloxHostConfig:407 ``` It's because hooks error is an Error object from Polyfill and tostring is not called by format (no idea why) Now the errors look like ``` Error applying initial props to Roblox Instance 'SizeConstraint' (UISizeConstraint): Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem. ``` Checklist before submitting: * [ ] Added/updated relevant tests * [ ] Added/updated documentation ---------
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the deprecated function attribute to every function exported by roact-compat.
Checklist before submitting: