Repository navigation
database: fold mass removals and additions - #402
Open
agorischek wants to merge 4 commits into
Open
agorischek wants to merge 4 commits into
agorischek wants to merge 4 commits into
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Fold interactions can report synthetic IDs to the host instead of expanding, while read-only fold tags remain keyboard-inaccessible and incorrectly marked disabled.
2 open issues
What changed in this PR
Extends #396’s mass-change folding to the database renderer, keeping large schema comparisons compact while allowing users to expand folded items.
Changes:
- Extracts a shared
useMassFoldshook and reuses it in GraphCanvas. - Adds database fold cards, rows, host aliases, and relationship routing.
- Adds a Prisma scenario, regression coverage, documentation, and changelog entries.
| File | Description |
|---|---|
| packages/renderers/kit/src/react/mass-folds.ts | Adds the shared folding hook. |
| packages/renderers/kit/src/react/graph-canvas/mass-folds.ts | Reuses the shared hook. |
| packages/renderers/kit/src/react.ts | Exports the folding API. |
| packages/renderers/database/test/mass-fold.test.mjs | Tests folding, aliases, and links. |
| packages/renderers/database/src/view.tsx | Integrates folding into the renderer. |
| packages/renderers/database/src/tags.tsx | Adds fold attributes to tags. |
| packages/renderers/database/src/table.tsx | Renders expandable fold cards and rows. |
| packages/renderers/database/src/styles.css | Styles fold headers and rows. |
| packages/renderers/database/src/schema-model.ts | Measures fold labels as prose. |
| packages/renderers/database/src/schema-links.ts | Routes folded links and orders rows. |
| packages/renderers/database/src/mass-folds.tsx | Provides fold attributes and icons. |
| packages/renderers/database/src/links-view.tsx | Omits host IDs from synthetic links. |
| packages/renderers/database/src/geometry.ts | Sizes folds as header-only cards. |
| packages/renderers/database/scenarios.json | Registers the partner-retirement scenario. |
| packages/renderers/database/README.md | Documents database folding. |
| packages/renderers/database/fixtures/prisma-partners/before/prisma/schema.prisma | Defines the original partner schema. |
| packages/renderers/database/fixtures/prisma-partners/after/prisma/schema.prisma | Defines the reduced schema. |
| packages/renderers/database/fixtures/prisma-partners-after.json | Supplies the extracted after fixture. |
| packages/renderers/database/fixtures/make-schemas.mjs | Adds partner fixture generation. |
| packages/renderers/database/browser/mass-fold.spec.ts | Tests fold interactions and focus. |
| packages/renderers/database/browser/diff.spec.ts | Adds scenario overlap coverage. |
| docs/reference/renderer-kit.md | Updates generated API documentation. |
| docs/guides/renderer-kit-graphs.md | Explains folding for custom layouts. |
| changelog.d/402.md | Announces database folding. |
| changelog.d/402-kit.md | Announces the shared hook. |
Review effort: Balanced
| className={`database-table pk-frame database-mass-fold${props.selectedId === change.id ? ' selected' : ''}`} | ||
| aria-label={entity.label} | ||
| data-entity-id={change.id} | ||
| {...useFoldAttributes(entity)} |
| data-entity-id={id} | ||
| {...foldAttributes} | ||
| aria-label={`${shown}${status}${former ? `, was ${former}` : ''}`} | ||
| {...selectControl(props.selectedId === id)} |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Refs #396
What changed
#396 folds a dozen or more sibling items that are removed (or added) together into one expandable summary card in the kit's
GraphCanvasandCardGrid. The database renderer lays out its own schema canvas, so #396 didn't fold its tables. This PR gives the database renderer the same behaviour:useMassFolds(props)(@githubnext/projections-renderer-kit/react) is the graph canvas's fold logic pulled out for any renderer that lays out its own model. It returns the props to draw:modelandschedulefolded, emphasis taken from what each card stands for, selection and focus requests moved onto the card, andonSelectof a fold or its links opening and closing it. It also returns each closed fold'saliases.GraphCanvasnow uses the same hook, so the behaviour is shared rather than copied.data-entity-id(pk-mass:…),data-entity-aliases,data-foldanddata-projections-action, so the host's selection, hover, filter and--entityfocus find it.data-entity-id.pk-label. The fold card's header is its only part, so it draws no rule of its own (a single border) and takes the card's bottom corners. The fold button adds no accent colour inside the card's change tint.database/prisma-partnersscenario: a realprisma-schemaextraction, generated byfixtures/make-schemas.mjs, in which a partner program of 14 tables and 2 enums is retired.test/mass-fold.test.mjs.browser/mass-fold.spec.ts, mirroring Kit: fold mass removals into one summary card #396's graph test.docs/reference/renderer-kit.md, regenerated withnode tools/scripts/reference-docs.mjs --only renderer-sdk. The regenerated page also picks up Kit: fold mass removals into one summary card #396'sfoldMassChangesexports, which weren't regenerated there.Evidence
dub (dubinc/dub) #4783 ("Simplify Dub", 48 tables removed):
projections compare b57281e..751c363 -p prisma-schema --trust --definition-revision working-tree --png …, run between the merge commit's parent and the merge commit.kit/fold-mass-removals)compare --png)compare --png(default, diff)rendererLimits, and the image is mostly blank.--mode side-by-side/--mode animatedThe All scope is still above 20,000 px. That isn't caused by the mass change: the head revision alone measures 975 × 20,661 px in the All scope.
Before (base branch):
After (this branch):
Checks I ran, all on chromium-desktop for the browser suites:
npm run tools -- check --fast: passnpm run tools -- check --affected: passnpm run typecheckfor the kit and database workspaces, andeslinton the changed files: passnpm run tools -- test packages/renderers/database: 48 passednpm run tools -- test packages/renderers/kit: 206 passednpx playwright test --project chromium-desktop database/browser(harness): 34 passednpx playwright test --project chromium-desktop --grep "database/"(harness checks on every database scenario): 112 passednpx playwright test --project chromium-desktop graph/browser/graph.spec.ts(the graph canvas, after the hook refactor): 19 passedHarness scenario-wide checks (
^database:, every built-in scenario, in every scenario, nested accents, extractions present): 15 passedNot run: WebKit and mobile projects, and the full
npm run docs:check, which needs the pinned Rust nightly for the Rust SDK pages.Documentation that this change affects is updated, and generated reference
pages are regenerated (
npm run docs:generate).Fixes include a regression test.
A changelog fragment at
changelog.d/<this PR's number>.mddescribes whatusers will notice, or the PR has the
no changeloglabel (seechangelog.d/README.md).
No credentials, private source or machine-specific paths are included.