breaking(internals): pass building blocks directly to internal functions#3280
Open
dmaskasky wants to merge 1 commit intopmndrs:mainfrom
Open
breaking(internals): pass building blocks directly to internal functions#3280dmaskasky wants to merge 1 commit intopmndrs:mainfrom
dmaskasky wants to merge 1 commit intopmndrs:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
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. |
commit: |
5b16239 to
ab0cc38
Compare
|
| Playground | Link |
|---|---|
| React demo | https://livecodes.io?x=id/E9ZC3LRQ8 |
See documentations for usage instructions.
ab0cc38 to
f59e61d
Compare
f59e61d to
8d2c768
Compare
Switch internal building-block function signatures and call sites from store-first to buildingBlocks-first, and update buildStore to wire store APIs from frozen building blocks while keeping weak map storage. Made-with: Cursor
8d2c768 to
116e6b4
Compare
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.
Summary
Since 2.14.0, the building block architecture relies on passing the store as the first parameter to internal functions. This store was used as a WeakMap key to access building blocks. WeakMap access is not super performant so in certain heavy applications, performance was impacted.
This PR reworks the building block architecture to directly pass buildingBlocks instead of store. This eliminates the WeakMap access per call site.
The breaking change is that BUILDING_BLOCK functions now accept buildingBlocks instead of store as the first parameter.
What was done
buildingBlocks-first.useAtomValueand internals tests to pass buildingBlocks instead of store as the first parameter.