Skip to content

tree: Track which fields change in anchorSet#22367

Merged
CraigMacomber merged 7 commits into
microsoft:mainfrom
CraigMacomber:anchorSetFieldChanges
Sep 3, 2024
Merged

tree: Track which fields change in anchorSet#22367
CraigMacomber merged 7 commits into
microsoft:mainfrom
CraigMacomber:anchorSetFieldChanges

Conversation

@CraigMacomber
Copy link
Copy Markdown
Contributor

Description

Split off from #22229 for a smaller review.

Reviewer Guidance

The review process is outlined on this wiki page.

@CraigMacomber CraigMacomber requested a review from a team as a code owner September 3, 2024 20:09
@github-actions github-actions Bot added area: dds Issues related to distributed data structures area: dds: tree base: main PRs targeted against main branch labels Sep 3, 2024
if (event === "childrenChangedAfterBatch") {
const fieldKeys = this.bufferedEvents
.filter((e) => e.node === node && e.event === event)
.map((e) => e.changedField as FieldKey);
Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@CraigMacomber CraigMacomber enabled auto-merge (squash) September 3, 2024 20:50
bufferedEvents: [] as {
node: PathNode;
event: keyof AnchorEvents;
changedField?: FieldKey;
Copy link
Copy Markdown
Contributor

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.

Comment thread packages/dds/tree/src/core/tree/anchorSet.ts Outdated
Copy link
Copy Markdown
Contributor

@Josmithr Josmithr left a 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.

Comment thread packages/dds/tree/src/core/tree/visitDelta.ts
Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
@CraigMacomber CraigMacomber enabled auto-merge (squash) September 3, 2024 21:25
@msfluid-bot
Copy link
Copy Markdown
Collaborator

@fluid-example/bundle-size-tests: +1.74 KB
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 459.92 KB 459.95 KB +35 Bytes
azureClient.js 557.96 KB 558.01 KB +49 Bytes
connectionState.js 680 Bytes 680 Bytes No change
containerRuntime.js 260.75 KB 260.76 KB +14 Bytes
fluidFramework.js 398.55 KB 399.31 KB +781 Bytes
loader.js 134.26 KB 134.28 KB +14 Bytes
map.js 42.39 KB 42.39 KB +7 Bytes
matrix.js 146.56 KB 146.56 KB +7 Bytes
odspClient.js 525.23 KB 525.28 KB +49 Bytes
odspDriver.js 97.72 KB 97.74 KB +21 Bytes
odspPrefetchSnapshot.js 42.78 KB 42.79 KB +14 Bytes
sharedString.js 163.26 KB 163.26 KB +7 Bytes
sharedTree.js 389.06 KB 389.82 KB +774 Bytes
Total Size 3.29 MB 3.29 MB +1.74 KB

Baseline commit: 6468aea

Generated by 🚫 dangerJS against d14cd89

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

Labels

area: dds: tree area: dds Issues related to distributed data structures base: main PRs targeted against main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants