Skip to content
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

Allow handling errors in getSnapshot of useSyncExternalStore & add more tests #4175

Merged
merged 4 commits into from
Oct 30, 2023

Conversation

andrewiggins
Copy link
Member

  • If getSnapshot throws an error while checking for an update, allow components to handle it by rerendering the component so that getSnapshot can throw again during render.
  • Move useSyncExternalStore tests into their own file
  • Copy relevant tests from React's test suite. I removed tests related to useSyncExternalStoreWithSelector since React doesn't support this and engineers have to use the shim package.
  • Add test for handling updates to store before subscribing in useEffect

@github-actions
Copy link

github-actions bot commented Oct 27, 2023

Size Change: +90 B (0%)

Total Size: 57.3 kB

Filename Size Change
compat/dist/compat.js 3.97 kB +28 B (0%)
compat/dist/compat.module.js 3.9 kB +28 B (0%)
compat/dist/compat.umd.js 4.04 kB +34 B (0%)
ℹ️ View Unchanged
Filename Size Change
debug/dist/debug.js 3.5 kB 0 B
debug/dist/debug.module.js 3.5 kB 0 B
debug/dist/debug.umd.js 3.58 kB 0 B
devtools/dist/devtools.js 231 B 0 B
devtools/dist/devtools.module.js 240 B 0 B
devtools/dist/devtools.umd.js 315 B 0 B
dist/preact.js 4.42 kB 0 B
dist/preact.min.js 4.45 kB 0 B
dist/preact.min.module.js 4.45 kB 0 B
dist/preact.min.umd.js 4.48 kB 0 B
dist/preact.module.js 4.45 kB 0 B
dist/preact.umd.js 4.48 kB 0 B
hooks/dist/hooks.js 1.53 kB 0 B
hooks/dist/hooks.module.js 1.56 kB 0 B
hooks/dist/hooks.umd.js 1.62 kB 0 B
jsx-runtime/dist/jsxRuntime.js 365 B 0 B
jsx-runtime/dist/jsxRuntime.module.js 331 B 0 B
jsx-runtime/dist/jsxRuntime.umd.js 445 B 0 B
test-utils/dist/testUtils.js 453 B 0 B
test-utils/dist/testUtils.module.js 454 B 0 B
test-utils/dist/testUtils.umd.js 536 B 0 B

compressed-size-action

@coveralls
Copy link

coveralls commented Oct 28, 2023

Coverage Status

coverage: 99.43% (+0.004%) from 99.426% when pulling a1ce2a7 on useSyncExternalStore-tests into 9956916 on main.

Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@andrewiggins andrewiggins merged commit 62c050f into main Oct 30, 2023
3 checks passed
@andrewiggins andrewiggins deleted the useSyncExternalStore-tests branch October 30, 2023 16:29
@JoviDeCroock JoviDeCroock mentioned this pull request Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants