breaking(internals): pass buildingBlockContext directly to internals#3280
Closed
dmaskasky wants to merge 11 commits intopmndrs:mainfrom
Closed
breaking(internals): pass buildingBlockContext directly to internals#3280dmaskasky wants to merge 11 commits intopmndrs:mainfrom
dmaskasky wants to merge 11 commits 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/95DBE3XWT |
See documentations for usage instructions.
ab0cc38 to
f59e61d
Compare
f59e61d to
8d2c768
Compare
8d2c768 to
116e6b4
Compare
dai-shi
reviewed
Apr 7, 2026
bc6e5bc to
8eb4631
Compare
8eb4631 to
cf5b182
Compare
cf5b182 to
92bbcfd
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
…nInit reads and invocation
6a7dcc0 to
d968676
Compare
84e7039 to
2d6cd7d
Compare
2d6cd7d to
37ae89a
Compare
37ae89a to
ee3b146
Compare
28e437d to
abacd95
Compare
abacd95 to
d9c89f4
Compare
e69e971 to
990820e
Compare
Member
|
Thanks so much for your experiments and insights! |
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 buildingBlocksContext
readonly [...buildingBlocks, store]instead ofstore. This eliminates the WeakMap access per call site.The breaking change is that BUILDING_BLOCK functions now accept buildingBlocksContext instead of store as the first parameter.
What was done
buildingBlocksContext-first.useAtomValueand internals tests to pass buildingBlocksContext instead of store as the first parameter.Next Steps
Other Changes
argsinstead of...argsWithOnInitandWithOnMounthasOnInitfor conditionally callingAtomOnInitgetInternalBuildingBlocks