-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Byte-shave various chunks of code #5129
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
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 7891846:
|
size-limit report 📦
|
✅ Deploy Preview for redux-starter-kit-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Eh, messing with Confirmed using some Sonda analysis in an actual Vite app example that this knocks about 0.6K off the final app size. |
glepretre
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| false, | ||
| ) | ||
| window.addEventListener('focus', handleFocus, false) | ||
| const WINDOW = window |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We lost the SSR support here in v2.10.0
UnhandledRejection ReferenceError: window is not defined
at defaultHandler (file:///node_modules/@reduxjs/toolkit/dist/query/rtk-query.modern.mjs:417:22
This PR byte-shaves a variety of repeated bits of code I saw:
setupListenersto reuse event names and deduplicatewindow.addEventListenerstatus === QueryStatus.initializedwere getting rewritten to=== "initialized"every time. The TS enum got runtime-compiled, but was unused. Added equivalent string constants, so the enum is now used for type-checks, but the constants are used for runtime comparisons.context.endpointDefinitions[endpointName], some action meta fields, promise ref unsubscribes)This looks like it knocks about 600 bytes minified off of the RTKQ core artifact, and another 200 bytes off of the RTKQ React artifact: