-
Notifications
You must be signed in to change notification settings - Fork 535
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
tree: Track which fields change in anchorSet #22367
tree: Track which fields change in anchorSet #22367
Conversation
if (event === "childrenChangedAfterBatch") { | ||
const fieldKeys = this.bufferedEvents | ||
.filter((e) => e.node === node && e.event === event) | ||
.map((e) => e.changedField as FieldKey); |
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 should use brand for a safer conversion
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.
actually, this is not casting a string to FIeldKey, but casting away undefined. If unchecked, this should use !
rather than as
for much better clarity and type safety. I'm going to make it checked via ?? instead.
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.
Done.
bufferedEvents: [] as { | ||
node: PathNode; | ||
event: keyof AnchorEvents; | ||
changedField?: FieldKey; |
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.
What does it mean for this to be undefined? Might be worth adding an explicit type for this so we can more easily document the properties.
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.
Left a couple of nitpick suggestions, but otherwise looks good to me.
Co-authored-by: Joshua Smithrud <[email protected]>
⯅ @fluid-example/bundle-size-tests: +1.74 KB
Baseline commit: 6468aea |
Description
Split off from #22229 for a smaller review.
Reviewer Guidance
The review process is outlined on this wiki page.