-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(Stepper): define the public context boundary and deprecate useStepperContext - #6074
Open
Alif416 wants to merge 3 commits into
Open
fix(Stepper): define the public context boundary and deprecate useStepperContext #6074Alif416 wants to merge 3 commits into
Alif416 wants to merge 3 commits into
Conversation
`@astryxdesign/core/Stepper` exported `useStepperContext` and the full `StepperContextValue`, which named Stepper's own coordination — `previousActiveStep` (connector-fill choreography) and `registerStep` (dev-mode duplicate-index registry). Both are described in-source as internal, and `Step` is their only consumer in the repo, but exporting them put them in the installable type surface: changing how the fill is choreographed could land as a consumer type break. Records the decision: the hook is NOT a supported extension point. A Stepper builds its context entirely from the props the caller passed it, so the hook returns nothing the call site already lacks — the custom-content showcase block already threads `active` from its own state rather than reading it back. Custom step composition is not supported through it either: the fill is choreographed inside `Step`, so a hand-rolled step reading the context still cannot draw a correct connector track. `<Step>`'s `children`, `indicator`, and `endContent` slots are the composition surface. - Split the context into the deprecated public `StepperContextValue` and a wider `StepperCoordination` that carries the private fields. One object on the wire; the split is about which declaration a consumer can reach. - `StepperCoordination` and `useStepperCoordination` are not re-exported from the barrel, closing the seam by module boundary rather than by an `@internal` tag — the same reasoning as Typeahead's `BusyIndicatorLane`. - `useStepperContext` and `StepperContextValue` stay exported, so the removal lands at an explicit compatibility boundary rather than in a patch. - Adds `Stepper.public.test.ts`, following the `*.public.test.ts` precedent: `expectTypeOf` locks the private fields off the public type and off the hook's return, asserts the deprecated names are still exported, and asserts the barrel's code never references the internal ones. Verified to bite by re-widening the type and watching exactly the matching lines fail typecheck. - Consumer guidance in all three Stepper.doc.mjs locale blocks.
Alif416
requested review from
cixzhang,
imdreamrunner and
josephfarina
as code owners
September 5, 2026 08:44
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@meta-cla
meta-cla
Bot
added
the
CLA Signed
This label is managed by the Meta Open Source bot.
label
Sep 5, 2026
@github-actions
github-actions
Bot
added
community
Authored by a community contributor (not on the eng/design team)
needs:code-review
High-risk change (new package/component/API) — needs human code review before merge
labels
Sep 5, 2026
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsStepper (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 serious. Stepper - 1 issue(s)
Visual RegressionStatus: No visual change across 2 compared shot(s). Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
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.
Decision
useStepperContextandStepperContextValueare not a supported extension point. Three things settled it:activeStep,orientation,density,indicatorPosition,onStepClick. The only fields genuinely new to it werepreviousActiveStepandregisterStep, which are exactly the private coordination.Step, so a hand-rolled step reading the context still cannot draw a correct track. The export advertised a capability it could not fulfill.StepperCustomContentblock already threadsactivefrom its own state — the idiomatic pattern.Custom composition is supported through
<Step>and itschildren,indicator, andendContentslots.Approach
Follows the doctrine already stated in
Typeahead/busyIndicatorLane.tsx: an@internaltag is a note to a reader, not a boundary. The seam is closed by module boundary instead.StepperContext.tssplits the shape. PublicStepperContextValuekeeps the six safe reads;StepperCoordinationextends it withpreviousActiveStepandregisterStep. One object on the wire — the split governs which declaration a consumer can reach, not a second allocation per render.StepperCoordinationanduseStepperCoordinationare never re-exported from the barrel.useStepperContextandStepperContextValuestay exported and@deprecated, so removal lands at an explicit major rather than in a patch.Acceptance criteria
@deprecatedblocks inStepperContext.ts+ the rationale block inindex.tsStepperCoordinationsplit, internal to the moduleStepper.public.test.tsStepper.doc.mjs— all three locale blocks (full,--dense,--zh)Testing
Stepper.public.test.tsfollows the existing*.public.test.tsprecedent:expectTypeOflocks the private fields off both the public type and the hook's return, asserts the deprecated names are still exported, and asserts the barrel's code never references the internal names.The guard was verified to bite, not assumed: re-widening
StepperContextValuewithregisterStepmade exactly the two matching assertions fail typecheck, while thepreviousActiveStepones correctly stayed silent.One caveat documented in the file header — these assertions are enforced by
pnpm -F @astryxdesign/core typecheck, not by the test run, and a failure surfaces as the crypticTS2554: Expected 2 arguments, but got 1.pnpm -F @astryxdesign/core typecheck— cleanpnpm check:repo— greenastryx component Stepper --denserenders the new guidanceNotes for review
No runtime behavior changes — this is a type-surface and documentation change. The one non-type edit is
Stepper.tsxannotating its provider value with the wider type, andStep.tsxswitching touseStepperCoordination.It should fixes #6060