Comments (4)
@gaearon yes! I actually started to work on a PR locally - it's very draft-ish and I only fixed one of the discrepancies so far. Gonna open a draft PR later today.
from react.
I was just about to report the same issue (my repro case can be found here, it's prepared based on @jmca's repro for the issue caused by this - but it's essentially the same repro as yours).
I think that useInsertionEffect
is essentially the same as useLayoutEffect
, it's just that they have a "higher priority" and they are executed first, in a batch, before useLayoutEffect
s. So I'm heavily leaning towards your conclusion - this is a bug in React. All other semantics of layout effects should be shared between useInsertionEffect
and useLayoutEffect
(such as semantics in suspense boundaries, mounting/unmounting them appropriately in Offscreen components, their reappearing and more)
from react.
Seems like a bug. Anyone wants to look into fixing it?
from react.
To rephrase what the observed issue here is:
- insertion effects are not disconnected when the suspended subtree gets hidden
- they are also not disconnected when a different subtree gets finally rendered (when Suspense resumes~)
- to get them to disconnect we need to "revisit" the old component and switch away from it without suspending.
- this doesn't match how any other type of effects work. I'd expect those effects to get disconnected in the similar vein as layout effects are but if that's not desirable for some reason then they likely should be disconnected just like passive effects (or using some different semantics of their own but the bottom line is that they should be disconnected at some point)
from react.
Related Issues (20)
- [DevTools Bug] Cannot add node "1" because a node with that id is already in the Store. HOT 4
- Muito bom, mas...
- Bug: "react-dom/client" render function fail on IE10 (with polyfills) HOT 3
- Bug: undefined behavior with input checkbox onChange not triggered HOT 4
- Bug: Text duplication in controlled component with iOS Japanese kana IME HOT 2
- Bug: css Clippath in style property not update HOT 1
- Bug: Android element inspector render error HOT 1
- Bug:
- useDeferredValue hook updates the deferred value immediately instead of after background re-render HOT 1
- Bug: horizontal scroll to bad white space on mobile version of application HOT 3
- Bug: doesn't connect via the network outside the host HOT 2
- Bug: hydration fails when using a text node in a form with server actions
- Feat request: addition of use client in a specific component HOT 3
- Bug: HOT 3
- Bug: async action transition branch not committed for 5000ms HOT 3
- Bug: useDeferredValue return value printing error
- [DevTools Bug]: shows "This page doesn't appear to be using React" for every react website on Firefox 115.0.2 HOT 13
- Bug: "Uncaught runtime error" after react-script upgrade
- Feature Request (react-hooks/exhaustive-deps): `ignoreObjectReferences` flag
- Bug: [React 18] componentWillReceiveProps causes Suspense to go into an infinite loop with React.lazy HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.