-
Notifications
You must be signed in to change notification settings - Fork 573
Update container-views example to match external-views infrastructure #26613
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
Merged
ChumpChief
merged 11 commits into
microsoft:main
from
ChumpChief:ContainerViewsConversion
Mar 3, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
04bb2a4
Update container-views example to match external-views infrastructure
ChumpChief 202e715
Update pnpm-lock.yaml for container-views dependency changes
ChumpChief 1073392
Fix trailing commas in container-views tsconfig.json for biome
ChumpChief b878334
Remove unused index.ts and package entry points from container-views
ChumpChief efaace5
Replace custom IContainerView with example-utils interfaces
ChumpChief f703f57
Remove unused aqueduct dependency from container-views
ChumpChief d5c88b4
Align container-views and diceroller examples
ChumpChief 8a3ac89
Simplify DiceRollerFactory.type to readonly property
ChumpChief 5ccf494
Align container-views and external-views examples
ChumpChief 056ae16
Make DiceRoller class private, use IDiceRoller interface in view call…
ChumpChief b3baebb
Apply suggestions from code review
ChumpChief File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| # @fluid-example/app-integration-container-views | ||
|
|
||
| **Dice Roller** is a basic example that has a die and a button. Clicking the button re-rolls the die and persists the value in the root SharedDirectory. | ||
| The **container-views** example has a dice and a button. Clicking the button re-rolls the dice and persists the value in a SharedMap. | ||
|
|
||
| This implementation demonstrates plugging the container into a standalone application, rather than using the webpack-fluid-loader environment that most of our packages use. This implementation relies on [Tinylicious](/server/routerlicious/packages/tinylicious), so there are a few extra steps to get started. We expect the container to respond with a mountable view that we can use for rendering. | ||
| This example demonstrates the container-views pattern. In this pattern, the container code (`src/container/index.ts`) establishes not only the model and controller logic (the DiceRoller, `diceRoller.ts`) but also the view code (`view.tsx`) and its binding to the model/controller. The container's entry point uses `ContainerViewRuntimeFactory` to provide an `IFluidMountableViewEntryPoint` (a mountable view with `mount`/`unmount` methods), so the consumer of the container (`app.ts`) simply mounts it into a DOM element without needing to know about the view implementation. | ||
|
|
||
| This is distinct from the external-views pattern, where the container only provides the data model and the consumer is responsible for creating and binding the view. The container-views pattern can be convenient when the container wants to control its own rendering, but may result in less view flexibility and larger-than-necessary bundle size (especially for headless usage). The external-views pattern is therefore recommended over the container-views pattern for general use. | ||
|
|
||
| <!-- AUTO-GENERATED-CONTENT:START (EXAMPLE_APP_README_HEADER:usesTinylicious=TRUE) --> | ||
|
|
||
|
|
@@ -43,9 +45,9 @@ For in browser testing update `./jest-puppeteer.config.js` to: | |
|
|
||
| ## Data model | ||
|
|
||
| Dice Roller uses the following distributed data structures: | ||
| DiceRoller uses the following distributed data structures: | ||
|
|
||
| - SharedDirectory - root | ||
| - SharedMap | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general, seems like a good follow up to probably switch our examples to SharedTree since that is what we'd like all new customers to use. But obviously not needed as part of this PR |
||
|
|
||
| <!-- AUTO-GENERATED-CONTENT:START (README_FOOTER) --> | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.