Skip to content

Update container-views example to match external-views infrastructure#26613

Merged
ChumpChief merged 11 commits intomicrosoft:mainfrom
ChumpChief:ContainerViewsConversion
Mar 3, 2026
Merged

Update container-views example to match external-views infrastructure#26613
ChumpChief merged 11 commits intomicrosoft:mainfrom
ChumpChief:ContainerViewsConversion

Conversation

@ChumpChief
Copy link
Contributor

@ChumpChief ChumpChief commented Mar 2, 2026

Summary

container-views restructuring

  • Restructure src/ into src/container/ subdirectory matching external-views layout (diceRoller/, view.tsx, container/index.ts)
  • Replace custom IContainerView interface with ContainerViewRuntimeFactory, IFluidMountableViewEntryPoint, and MountableView from @fluid-example/example-utils (matching the diceroller example pattern)
  • Use lower-level FluidDataStoreRuntime and IFluidDataStoreFactory for the DiceRoller data store (instead of DataObject/DataObjectFactory from aqueduct)
  • Remove unused src/index.ts package entry point and @fluidframework/aqueduct dependency
  • Add multi-service support (local/t9s/odsp) via @fluid-example/example-driver and @fluid-example/example-webpack-integration
  • Switch to default html-webpack-plugin template (remove src/index.html)
  • Modernize tests to use puppeteer directly with manual browser lifecycle management
  • Add cross-container event propagation test ("raises an event in other connected containers")
  • Update eslint config from minimalDeprecated to recommended

Align all three dice roller examples (container-views, external-views, diceroller)

  • Apply external-views dice styling (dynamic color, centered layout, larger fonts) to container-views and diceroller
  • Use named React imports (createElement, FC, useState, useEffect) instead of default React.xxx style
  • Use diceRoller as the view prop name with destructured parameters
  • Add explicit (): void return type on useEffect cleanup functions
  • Add "react" to tsconfig types in external-views
  • Fix missing const in diceroller jest.config.cjs
  • Remove unused dependencies: uuid from diceroller; uuid, process from external-views
  • Remove dead main/types fields from external-views package.json
  • Fix description in external-views: "Data Object" → "data store"
  • Fix typo in diceroller: "rolls the device" → "rolls the dice"
  • Align test names across examples
  • Simplify DiceRollerFactory.type to a readonly property

Test plan

  • pnpm run build passes (biome, tsc, eslint)
  • pnpm run test:jest passes (puppeteer tests validate button loads and cross-container sync)
  • Manual test: pnpm run start:local — app loads at localhost:8080, dice rolls work
  • Manual test: open a second browser tab with the same container ID — dice rolls sync

🤖 Generated with Claude Code

ChumpChief and others added 10 commits March 2, 2026 12:02
Replace example-utils/aqueduct abstractions with example-driver and direct
container-loader APIs. Restructure src into container/ subdirectory, switch
to default html-webpack-plugin template, add multi-service support
(local/t9s/odsp), and modernize tests to use puppeteer directly. The
container-views pattern is preserved via an IContainerView entry point
that bundles mount/unmount with the container.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The package is private and nothing imports it; the webpack entry point is app.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use ContainerViewRuntimeFactory, IFluidMountableViewEntryPoint, and
MountableView from @fluid-example/example-utils instead of the custom
IContainerView interface and DiceRollerContainerRuntimeFactory, matching
the pattern used by the diceroller example.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use named React imports (createElement, FC, useState, useEffect) in both
- Rename view prop to diceRoller and destructure in parameter in both
- Add missing "react" type to container-views tsconfig.json
- Align test name to "The page loads and there's a button with Roll"
- Add "// Render view" comment to container-views app.ts
- Fix missing const in diceroller jest.config.cjs
- Fix "device" typo to "dice" in diceroller JSDoc
- Remove unused uuid dependency from diceroller

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Apply external-views dice styling (dynamic color, centered layout, larger
fonts) to container-views and diceroller. Align external-views with the
other examples: add explicit return type on useEffect cleanup, add react
to tsconfig types, update test name, remove dead main/types fields,
remove unused uuid and process dependencies, fix description.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…back

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ChumpChief ChumpChief marked this pull request as ready for review March 3, 2026 01:05
Copilot AI review requested due to automatic review settings March 3, 2026 01:05
@ChumpChief
Copy link
Contributor Author

Human note: This PR updates container-views in the same way that I've updated external-views and diceroller in the past, so most of the changes are there (esp. app.ts).

The changes in external-views and diceroller are more minor or stylistic changes to better align the three examples.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the container-views example app (and aligns related dice roller examples) to match the newer “external-views” infrastructure/patterns, including multi-service driver support, modernized runtime/view wiring, and refreshed tests/styling.

Changes:

  • Restructures container-views to use ContainerViewRuntimeFactory + FluidDataStoreRuntime (removing Aqueduct/DataObject usage) and adopts the shared example-driver + webpack-integration service selection flow.
  • Modernizes browser tests to use puppeteer directly and adds a cross-container event propagation test.
  • Aligns dice roller UI and React usage across container-views, external-views, and diceroller, plus trims unused deps/config entries.

Reviewed changes

Copilot reviewed 29 out of 30 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pnpm-lock.yaml Updates lockfile for removed/added example dependencies.
examples/view-integration/external-views/tsconfig.json Adds react to types for TS in this example.
examples/view-integration/external-views/tests/externalViews.test.ts Renames a test for consistency.
examples/view-integration/external-views/src/view.tsx Adds explicit (): void return type to effect cleanup.
examples/view-integration/external-views/package.json Cleans description/fields and removes unused deps.
examples/view-integration/container-views/webpack.config.cjs Switches to example-driver service plugin + ODSP middleware wiring and updates HTML plugin usage.
examples/view-integration/container-views/tsconfig.json Updates TS types list and includes tests in compilation.
examples/view-integration/container-views/tests/diceRoller.test.ts Removes obsolete skipped test file.
examples/view-integration/container-views/tests/containerViews.test.ts Adds puppeteer-driven integration tests including cross-container event propagation.
examples/view-integration/container-views/src/view.tsx Removes old view implementation (moved under src/container/).
examples/view-integration/container-views/src/model.ts Removes Aqueduct DataObject-based implementation.
examples/view-integration/container-views/src/interface.ts Removes old interface (replaced by new diceRoller interface).
examples/view-integration/container-views/src/index.ts Removes unused package entrypoint exports.
examples/view-integration/container-views/src/index.html Removes custom HTML template in favor of default html-webpack-plugin template.
examples/view-integration/container-views/src/containerCode.ts Removes old ModelContainerRuntimeFactory-based wiring.
examples/view-integration/container-views/src/container/view.tsx Adds new container-scoped React view aligned with other examples.
examples/view-integration/container-views/src/container/index.ts Exports fluidExport via ContainerViewRuntimeFactory and binds view callback.
examples/view-integration/container-views/src/container/diceRoller/interface.ts Defines typed events + public dice roller API via core-interfaces.
examples/view-integration/container-views/src/container/diceRoller/index.ts Barrel exports for dice roller types/factory.
examples/view-integration/container-views/src/container/diceRoller/diceRoller.ts Implements dice roller as a FluidDataStoreRuntime-based store + factory.
examples/view-integration/container-views/src/app.ts Reworks app bootstrap to use example-driver multi-service flow and mount the container-provided view.
examples/view-integration/container-views/package.json Updates scripts for multi-service start modes and adjusts deps (removes Aqueduct, adds driver + lower-level runtime packages).
examples/view-integration/container-views/jest.config.cjs Fixes missing const and keeps jest-puppeteer preset setup.
examples/view-integration/container-views/jest-puppeteer.config.cjs Updates server command to use start:test.
examples/view-integration/container-views/eslint.config.mts Switches eslint config from minimalDeprecated to recommended.
examples/view-integration/container-views/README.md Updates example description and data model summary (needs terminology corrections).
examples/apps/diceroller/src/container/main.tsx Aligns React usage, prop naming, styling, and fixes typo (“dice”).
examples/apps/diceroller/src/container/index.ts Switches to createElement + aligns callback parameter naming/typing.
examples/apps/diceroller/package.json Removes unused uuid dependency.
examples/apps/diceroller/jest.config.cjs Fixes missing const for mappedPort.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> fluid-framework-docs-site@0.0.0 ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> fluid-framework-docs-site@0.0.0 serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> fluid-framework-docs-site@0.0.0 check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  257792 links
    1822 destination URLs
    2063 URLs ignored
       0 warnings
       0 errors


* Licensed under the MIT License.
*/

import React, { type FC, useEffect, useState } from "react";
Copy link

Choose a reason for hiding this comment

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

Same question, why the mix of specific and general imports

DiceRoller uses the following distributed data structures:

- SharedDirectory - root
- SharedMap
Copy link

Choose a reason for hiding this comment

The 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

@ChumpChief ChumpChief requested a review from alexvy86 March 3, 2026 18:16
Copy link
Contributor

@alexvy86 alexvy86 left a comment

Choose a reason for hiding this comment

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

Infra changes look good, in line with the ones in the other examples. Shahar's comments are worth addressing IMO. Since it's a relatively mechanical change replicating what you've done before I didn't scrutinize every line, but overall it looked fine.

@ChumpChief
Copy link
Contributor Author

Infra changes look good, in line with the ones in the other examples. Shahar's comments are worth addressing IMO. Since it's a relatively mechanical change replicating what you've done before I didn't scrutinize every line, but overall it looked fine.

I'm actually attempting an update to use React's new JSX transform at this very moment :)

@ChumpChief ChumpChief merged commit 0d43253 into microsoft:main Mar 3, 2026
34 checks passed
@ChumpChief ChumpChief deleted the ContainerViewsConversion branch March 3, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants