-
-
Notifications
You must be signed in to change notification settings - Fork 638
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
[INTERNAL] Add batch to listeners #2887
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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: |
Preview in LiveCodesLatest commit: 2799d73
See documentations for usage instructions. |
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.
It complicates further than I expect. I'd like to simplify. Unfortunately, this isn't acceptable for now.
Naming functions seems good.
@@ -198,9 +200,12 @@ const registerBatchAtom = ( | |||
) => { | |||
if (!batch.D.has(atom)) { | |||
batch.D.set(atom, new Set()) | |||
addBatchFunc(batch, 'M', () => { | |||
atomState.m?.l.forEach((listener) => addBatchFunc(batch, 'M', listener)) |
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.
I would like to avoid this hack too.
@@ -503,7 +508,7 @@ const buildStore = ( | |||
|
|||
// Step 2: use the topSortedReversed atom list to recompute all affected atoms | |||
// Track what's changed, so that we can short circuit when possible | |||
addBatchFunc(batch, 'H', () => { | |||
const finishRecompute = () => { |
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.
Though increasing bundle size, this is more readable.
@@ -645,14 +651,15 @@ const buildStore = ( | |||
isSync = false | |||
} | |||
} | |||
addBatchFunc(batch, 'L', () => { | |||
const processOnMount = () => { |
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.
This too.
Summary
This PR does not change API or behavior.
Check List
pnpm run prettier
for formatting code and docs