Repository navigation
feat: add react-components TabSheet and MasterDetailLayout wrappers - #13033
Conversation
b194b2f to
f2acc98
Compare
b41c389 to
47e2a8f
Compare
f2acc98 to
7782c9d
Compare
47e2a8f to
ebf1719
Compare
7782c9d to
eb9ad04
Compare
ebf1719 to
4a893bc
Compare
eb9ad04 to
b10fe6a
Compare
4a893bc to
68875da
Compare
b10fe6a to
5271cd1
Compare
68875da to
bd1db83
Compare
5271cd1 to
541285f
Compare
bd1db83 to
32320bc
Compare
27b1c87 to
53d9990
Compare
32320bc to
adf3f82
Compare
adf3f82 to
51e9da5
Compare
259d4bf to
bd8b8a8
Compare
51e9da5 to
3a187d8
Compare
Part of #12855 Fourth slice of the vaadin/react-components port: the last two hand-written wrappers, their specs, the SideNav and themed component specs, the type-level tests without their pro parts, and the package README and LICENSE. The src listing now matches the source repository. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
3a187d8 to
bc54fef
Compare
vaadin-review-bot
left a comment
There was a problem hiding this comment.
Reviewed the changes — left 3 comments.
| Finding | |
|---|---|
| The cloned outgoing detail is appended to the layout and never removed | |
| 🧪 | Transition tests stub _startTransition with behavior that differs from the real one |
| Transition completion writes stale children when the detail changes mid-transition |
| // so the WC's post-animation cleanup won't remove it from the DOM. | ||
| const clone = currentDetailsRef.current.cloneNode(true) as HTMLElement; | ||
| clone.setAttribute('slot', 'detail-outgoing'); | ||
| layout.appendChild(clone); |
There was a problem hiding this comment.
Every replace transition appends one clone that nothing ever removes: the web component's cleanup in __replaceTransition only removes the old detail when its slot is still detail-outgoing, and the wrapper deliberately changes it to detail-hidden.
Two consequences:
- The DOM grows by a full copy of the detail view (including duplicate
ids) per replace. - From the second replace onwards, the
detail-outgoingslot holds several clones. They become visible together while[transition="replace"]is set, so the outgoing animation shows the oldest clone instead of the view being replaced. Reproducible on the new dev page by pressing Replace twice: the second animation slides out "Detail Setup GitHub Actions to test in Chrome #1".
The clone needs to be removed once _startTransition resolves.
MasterDetailLayout.tsx:109 · correctness
| layout = document.querySelector('vaadin-master-detail-layout')!; | ||
| expect(layout).to.exist; | ||
|
|
||
| (layout as any)._startTransition = (transitionType: string, callback: () => void) => { |
There was a problem hiding this comment.
🧪 Transition tests stub _startTransition with behavior that differs from the real one
The stub invokes the callback and resolves immediately. The real implementation moves the current detail into the detail-outgoing slot before calling the callback and removes it afterwards unless the slot was reassigned. That handoff is the whole point of the replace branch in the wrapper, and no test exercises it — should call recalculateLayout after Lit elements have rendered is the only test on the real implementation and it only covers add.
A replace test against the real _startTransition would have caught the orphan clone.
MasterDetailLayout.spec.tsx:55 · tests
There was a problem hiding this comment.
Let's keep existing tests for now and fix it later.
| }) | ||
| .then(() => { | ||
| // Animation finished — sync React state to match DOM reality | ||
| setCurrentChildren(children); |
There was a problem hiding this comment.
The layout effect's deps are [state, currentChildren], so a detail change while a transition is running does not re-run it, and the pending .then() still closes over the old children. It then commits the previous view into currentChildren, so the detail renders view A again before the follow-up effect detects the difference and animates A → B a second time.
Trigger: selecting a second item before the first transition's animation finishes.
Inherited from the source repo, and the dependency array is intentionally unchanged, so it may be worth filing upstream rather than fixing here.
MasterDetailLayout.tsx:128 · correctness
There was a problem hiding this comment.
Also reported in vaadin/react-components#412.
…est and dev page The component is stable since #11773, the flag is no longer read. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
|
This ticket/PR has been released with Vaadin 25.4.0-alpha3. |



Description
Part of #12855
Depends on #13035
Fourth slice of the
vaadin/react-componentsport. With it,packages/react-components/srcholds the same 84 modules as the source repository. The package staysprivate: trueuntil the pro package lands.TabSheetandMasterDetailLayoutwrappersTabSheetandMasterDetailLayoutspecsTabSheetandTabSheetTabassertions to the type-level testtest/typings/api.tsTabSheetandMasterDetailLayout(with its stylesheet) in a separate commitType of change
How to test
yarn release:reactyarn test:reactyarn start:react/dev/lists eight pages, and theTabSheetandMasterDetailLayoutpages renderNote
Source commit ported:
vaadin/react-components@4dc4850d1ccec7c45e4394d1c9b79599b9dabd69. Expected mechanical differences from the source files: license headers, Prettier andeslint --fixformatting, inlinereact-hooks/exhaustive-depssuppressions with reasons, import paths. Type-level autofixes:*Elementimports as types,_startTransitionas a method signature. Two inlineexhaustive-depssuppressions inMasterDetailLayout.tsxwith the dependency arrays unchanged.@typescript-eslint/no-namespaceis turned off for the test scope becauseMasterDetailLayout.spec.tsxaugmentsJSX.IntrinsicElements. Vitest: 17 files, 94 tests.exportsmap: 219 keys, identical to the published 25.4.0-alpha1 map.🤖 Generated with Claude Code