Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Compose createDevStore with previous createStore#199

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
dmaskasky wants to merge2 commits intojotaijs:main
base:main
Choose a base branch
Loading
fromdmaskasky:dmaskasky-compose-with-prevstore

Conversation

@dmaskasky
Copy link
Member

Summary

If a previous createStore has already overridden createStore, we should try our best to compose with it.

@codesandbox-ci
Copy link

codesandbox-cibot commentedJul 22, 2025
edited
Loading

This pull request is automatically built and testable inCodeSandbox.

To see build info of the built libraries, clickhere or the icon next to each commit SHA.

Comment on lines 165 to 180
constprevStore=prevCreateStore?.();
constbuildingBlocks=(
prevStore ?INTERNAL_getBuildingBlocksRev1(prevStore) :[]
)asBuildingBlocks;
buildingBlocks[0]??=newWeakMap();
buildingBlocks[1]??=newWeakMap();
buildingBlocks[6]??={};
conststoreHooks=INTERNAL_initializeStoreHooks(buildingBlocks[6]);
constatomWrite=buildingBlocks[8];
buildingBlocks[8]=(atom,get,set, ...args)=>{
if(inRestoreAtom){
returnset(atom, ...args);
}
returnatomWrite
?atomWrite(atom,get,set, ...args)
:atom.write(get,set, ...args);
};
conststore=INTERNAL_buildStore(...buildingBlocks);
const[atomStateMap,mountedAtoms]=buildingBlocks;
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

@dai-shi
I think we need more thought around how to derive a store from a previous store. Currently, overriding certain building blocks won't work as expected.

Copy link
Member

@dai-shidai-shi left a comment

Choose a reason for hiding this comment

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

Again, thanks for working on this.

@dmaskaskydmaskaskyforce-pushed thedmaskasky-compose-with-prevstore branch 2 times, most recently from26b1d10 to5c27901CompareJuly 23, 2025 08:23
@dmaskaskydmaskaskyforce-pushed thedmaskasky-compose-with-prevstore branch from5c27901 to2c586d0CompareJuly 23, 2025 09:07
@dmaskaskydmaskasky requested a review fromdai-shiJuly 23, 2025 09:10
constprevStore=prevCreateStore?.()??INTERNAL_buildStore();
constbuildingBlocks=[
...INTERNAL_getBuildingBlocksRev1(prevStore),
]asBuildingBlocks;
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it already mutable without the type annotation?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I think buildingBlocks should be frozen.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it should be frozen. I'm only talking about the typing. Doesn't this work?

constbuildingBlocks=[    ...INTERNAL_getBuildingBlocksRev1(prevStore),];

@sebinsua
Copy link

Since updatingjotai-devtools andjotai in my project, the devtools shows no atoms at all.

Do you know if this fixes that issue? It might somehow relate to my project using a custom store or it could be something else. I've not been able to work out what's happening yet.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@dai-shidai-shidai-shi left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@dmaskasky@sebinsua@dai-shi

[8]ページ先頭

©2009-2025 Movatter.jp