Skip to content
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

Deprecate SharedNumberSequence and SharedObjectSequence, and remove most usage of SharedObjectSequence #8585

Merged
merged 12 commits into from
Dec 20, 2021

Conversation

ChumpChief
Copy link
Contributor

This change is part of #8526

This change marks SharedNumberSequence and SharedObjectSequence as deprecated to discourage new usage, and removes most SharedObjectSequence usage in our repository (replay-tool is left unchanged). It also removes the useSyncedArray from @fluid-experimental/react which depended on SharedObjectSequence.

Changes to examples:

  • likes-and-comments: Removed the comments portion which relied on SharedObjectSequence, leaving it as just "likes"
  • badge: Removed history functionality
  • shared-text: Removed test object
  • monaco: Removed extraneous registry entry
  • todo: Convert back to map-based approach

I recognize that some of these example changes are not ideal, but I think we should continue discussion of the scenario in #8526.

@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: sharedstring area: dev experience Improving the experience of devs building on top of fluid area: examples Changes that focus on our examples area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct breaking change This PR or issue would introduce a breaking change labels Dec 17, 2021
@ChumpChief ChumpChief requested a review from a team as a code owner December 17, 2021 20:49
@github-actions github-actions bot removed the request for review from a team December 17, 2021 20:49
@github-actions github-actions bot added the public api change Changes to a public API label Dec 17, 2021
@@ -7,14 +7,12 @@ import { DataObject } from "@fluidframework/aqueduct";
import { SharedCell } from "@fluidframework/cell";
import { IFluidHandle } from "@fluidframework/core-interfaces";
import { SharedMap } from "@fluidframework/map";
import { SharedObjectSequence } from "@fluidframework/sequence";
import { IBadgeModel, IBadgeHistory, IBadgeType } from "./Badge.types";
import { IBadgeModel, IBadgeType } from "./Badge.types";
import { defaultItems } from "./helpers";

export class Badge extends DataObject implements IBadgeModel {
private _currentCell: SharedCell<IBadgeType> | undefined;
private _optionsMap: SharedMap | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

i wonder it this could be refactored to use maxtrix, and just have a single column and insert rows.

this would keep the functionally @tylerbutler wants

Copy link
Contributor

Choose a reason for hiding this comment

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

i'd be fine to just remove this part of the change, and open an issue to move it to matrix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took this functionality as existing for the purpose of demonstrating SharedObjectSequence as a DDS to use, rather than the functionality being critical to preserve through alternate means. Since we don't recommend SharedObjectSequence as a DDS to use anymore, I don't think it's particularly troubling to drop the functionality.

For implementation (SharedObjectSequence vs. matrix) I think it's not a perfect option either way, since the "source of truth" for latest state is duplicated between the cell and the history. Without grouping the cell set and the history append, I think there's technically risk that the cell and latest history could disagree for simultaneous changes from different clients.

Copy link
Contributor

@anthony-murphy anthony-murphy Dec 18, 2021

Choose a reason for hiding this comment

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

@tylerbutler would be the best person to answer. he brought this up as a use case

Copy link
Member

Choose a reason for hiding this comment

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

Removing the history feature from the example is OK with me. We have captured the use-case, and I'm fine with a follow-up to re-add the feature if we conclude it's a good example for how we think matrix (or whatever we decide) should be used.

Copy link
Member

@tylerbutler tylerbutler left a comment

Choose a reason for hiding this comment

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

Minor stuff.

BREAKING.md Outdated Show resolved Hide resolved
packages/dds/sequence/README.md Show resolved Hide resolved
packages/dds/sequence/src/sequenceFactory.ts Show resolved Hide resolved
packages/framework/undo-redo/README.md Outdated Show resolved Hide resolved
packages/framework/undo-redo/src/index.ts Outdated Show resolved Hide resolved
// Store the handle to the component in the sequence
this.todoItems.insert(this.todoItems.getLength(), [component.handle]);
// Generate a key that we can sort on later, and store the handle.
this.todoItemsMap.set(`${Date.now()}-${uuid()}`, component.handle);
Copy link
Contributor

Choose a reason for hiding this comment

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

we should put the timestamp in the item, so {handle, timestamp}. it doesn't matter much is this case, but if you wanted to reorder this would be the way, as changes to the sort key, timestamp in this case, would coalesce. Even better than a single object in a single map key would be a subdirectory per entry

Copy link
Contributor

@anthony-murphy anthony-murphy Dec 17, 2021

Choose a reason for hiding this comment

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

i just don't want the sort by map key in our example, as it prevents move, which is a common next step for a scenario like this

Copy link
Contributor

Choose a reason for hiding this comment

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

similarly, we could revert this, and open an issue to correctly fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in latest to store the index in the map value rather than sorting on the key.

I am eager to eliminate usage of SharedObjectSequence to prevent copycatting so don't want to revert, but acknowledge that there will be better solutions. I think we should let this scenario help drive design ideas in #8526.

@ChumpChief ChumpChief requested a review from a team as a code owner December 17, 2021 23:43
@github-actions github-actions bot removed the request for review from a team December 17, 2021 23:43
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Dec 17, 2021
@github-actions
Copy link
Contributor

🔗 Found some broken links! 💔

Run a link check locally to find them. See
https://github.com/microsoft/FluidFramework/wiki/Checking-for-broken-links-in-the-documentation for more information.

linkcheck output


> [email protected] linkcheck /home/runner/work/FluidFramework/FluidFramework/docs
> npm run linkcheck:fast -- --external


> [email protected] linkcheck:fast /home/runner/work/FluidFramework/FluidFramework/docs
> linkcheck http://localhost:1313 --skip-file skipped-urls.txt "--external"

Crawling...

http://localhost:1313/css/style.min.d9e9ba8e11f13c0d4dc88bcd0747919ce60e63bd02fef906bfaa1cbfd8595d45.css
- (1:1272) url(...) => https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.eot? (HTTP 503)
- (1:1740) url(...) => https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semilight/latest.svg (HTTP 503)
- (1:3130) url(...) => https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/semibold/latest.svg (HTTP 503)
- (1:3811) url(...) => https://c.s-microsoft.com/static/fonts/segoe-ui/west-european/bold/latest.svg (HTTP 503)


Stats:
    4385 links
     198 destination URLs
       1 URLs ignored
       0 warnings
       4 errors


@msfluid-bot
Copy link
Collaborator

@fluid-example/bundle-size-tests: +2.17 KB
Metric NameBaseline SizeCompare SizeSize Diff
container.js 172.21 KB 173.42 KB +1.21 KB
map.js 47.34 KB 47.65 KB +313 Bytes
matrix.js 142.85 KB 143.18 KB +338 Bytes
odspDriver.js 186.59 KB 186.59 KB No change
odspPrefetchSnapshot.js 41.28 KB 41.28 KB No change
sharedString.js 163.66 KB 163.99 KB +338 Bytes
Total Size 786.62 KB 788.79 KB +2.17 KB

Baseline commit: 497a706

Generated by 🚫 dangerJS against 0af69f4

@anthony-murphy anthony-murphy merged commit 42e6f0e into microsoft:main Dec 20, 2021
@ChumpChief ChumpChief deleted the SharedObjectSequenceTrim branch December 20, 2021 20:59
@ChumpChief
Copy link
Contributor Author

Thanks! :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: sharedstring area: dds Issues related to distributed data structures area: dev experience Improving the experience of devs building on top of fluid area: examples Changes that focus on our examples area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: website breaking change This PR or issue would introduce a breaking change documentation Improvements or additions to documentation public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants