v6: lock down the @graphiql/react public surface before 6.0.0#4431
Draft
trevor-scheer wants to merge 3 commits into
Draft
v6: lock down the @graphiql/react public surface before 6.0.0#4431trevor-scheer wants to merge 3 commits into
@graphiql/react public surface before 6.0.0#4431trevor-scheer wants to merge 3 commits into
Conversation
`getRunBlockReason`, `resolveActiveOperation`, and `MUTATION_REQUIRES_POST_REASON` are Run-button implementation detail with no docs or changeset, re-exported through `utility/index.ts` by accident. Drop them from the public barrel; the two internal call sites now import `./run-block` directly.
`VarTab` is about as generic as a type name gets in a shared package namespace. Name it for the component it belongs to. `Operation` keeps its name: it's toolkit's type, re-exported here because `MethodPillProps.operation` needs it. Aliasing it would give one type two public names.
…blic barrel These container/presentational splits export a presentational twin alongside each container (TopBar/TopBarView, etc.), but nothing outside graphiql-react imports the *View half — its own tests and stories already import from the component's own file, not the package barrel. They read as Storybook/testability plumbing rather than consumer API, so drop them from components/index.ts. The container components (TopBar, StatusBar, SidePanel) stay public, as do the genuine response views (ResponseTreeView, ResponseTableView), which are documented JSON/Tree/Table components.
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.
Summary
An audit of
@graphiql/react's public barrels turned up a handful of exports that read as internal or dangerously generic. None have docs or a changeset, which is itself the signal they weren't meant to be public. Since everything here is unreleased ongraphiql-6, this is the last window to fix it without a deprecation cycle.getRunBlockReason,resolveActiveOperation, andMUTATION_REQUIRES_POST_REASONwere re-exported fromutility/index.tseven though they're pure Run-button implementation detail. Dropped from the barrel; the two internal call sites (stores/execution.ts,top-bar) now import./run-blockdirectly.VarTab(exported alongsideVarHeadersStrip) is about as generic as a type name gets in a shared package namespace. Renamed toVarHeadersTab.Operation(exported alongsideMethodPill) keeps its name. It's defined in@graphiql/toolkitand re-exported here becauseMethodPillProps.operationis typed with it, so it's effectively part of this package's API whether or not it originates here. Renaming it would leave one type with two public names, which is worse than the generic name it has now. Consumers get it from@graphiql/reactwithout needing a direct toolkit dependency.TopBarView/StatusBarView/SidePanelView(and their prop types) are the presentational half of a container/presentational split, exported alongsideTopBar/StatusBar/SidePanel. Nothing outsidegraphiql-reactimports them — even their own tests and stories already import from the component's own file, not the barrel — so they read as Storybook plumbing, not consumer API. Dropped from the barrel. The container components stay public, and so do the genuine response views (ResponseTreeView,ResponseTableView), which are real documented JSON/Tree/Table components, not a naming coincidence with the*Viewpattern above.PortalProvider/usePortalContainerstay public. They're not leaked plumbing:graphiql's own<GraphiQL>component uses them to wire its container element into Radix's dialog/tooltip/dropdown portals so themed content doesn't fall back to rendering intodocument.body. Anyone assembling a custom shell around@graphiql/reactcomponents directly needs the same hook. The contract is already documented in the module's JSDoc.Test plan
getRunBlockReason,resolveActiveOperation, orMUTATION_REQUIRES_POST_REASONfrom@graphiql/reactand confirm none of them resolve anymore.Operationfrom@graphiql/reactand confirm it still resolves, with the'query' | 'mutation' | 'subscription'shape, and that it's assignable toMethodPillProps['operation'].VarTabfrom@graphiql/reactand confirm it no longer resolves; importVarHeadersTaband confirm it does.TopBarView,StatusBarView, orSidePanelViewfrom@graphiql/reactand confirm none of them resolve anymore; confirmTopBar,StatusBar, andSidePanelstill do.PortalProviderandusePortalContainerstill import cleanly from@graphiql/react.run-blockpath end to end).yarn workspace @graphiql/react testpasses.Refs: #4219