-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix react 18 failing test #897
Comments
The library expects a DOM commit between two setState calls to calc position correct, but React 18 batches those two renders into one commit stickyInstance.updateInitialDimension();
stickyInstance.forceUpdate(() => stickyInstance.update()); or stickyInstance.updateInitialDimension();
flushSync(() => stickyInstance.update()); |
@RainGrid do you know the proper way to get access to the instance to force the update? |
const stickyRef = useRef(null); |
@RainGrid that works for hooks, but sticky-node is a class-based component. We will need a non-hook approach. |
@redonkulus you can call this.forceUpdate(); inside the Sticky component |
During React 18 testing one unit test was not passing, further debugging is required. The package was published to unblock users from upgrading to React 18. This bug could break your application!
Issue when running the test:
The text was updated successfully, but these errors were encountered: