Skip to content

fix(split-pane): inline default literal for when#31164

Closed
gnbm wants to merge 2 commits into
mainfrom
fix/split-pane-when-default-literal
Closed

fix(split-pane): inline default literal for when#31164
gnbm wants to merge 2 commits into
mainfrom
fix/split-pane-when-default-literal

Conversation

@gnbm
Copy link
Copy Markdown
Contributor

@gnbm gnbm commented May 22, 2026

Issue number: resolves N/A


What is the current behavior?

IonSplitPane.when is initialized to QUERY['lg'], where QUERY is a local const mapping shortcut keys to CSS media query strings.

An upcoming Stencil compiler change (ionic-team/stencil#6728) resolves @Prop default initializers that reference identifiers / property accesses / element accesses to their underlying primitive literal when generating components.d.ts. Once that change ships, a clean rebuild of @ionic/core will produce a components.d.ts whose @default JSDoc reads '(min-width: 992px)' instead of the committed QUERY['lg'], failing the git diff --exit-code guard in test-core-clean-build, build-angular, build-vue, and build-react.

The Stencil Nightly Build (#931) — which is pointed at Stencil's main — is already failing on exactly this diff:

-          * @default QUERY['lg']
+          * @default '(min-width: 992px)'

What is the new behavior?

  • core/src/components/split-pane/split-pane.tsx: inline the literal '(min-width: 992px)' as the prop default instead of dereferencing QUERY['lg'].
  • core/src/components.d.ts: regenerate the two @default JSDoc lines (one in Components, one in LocalJSX) to match.

Both the current and upcoming Stencil compiler now emit identical output. Runtime behavior is unchanged: the shortcut lookup QUERY[query] || query continues to resolve user-supplied shortcuts ('lg', 'md', etc.) via the QUERY map at the same place as before.

Does this introduce a breaking change?

  • Yes
  • No

The default value is identical ('(min-width: 992px)' is exactly what QUERY['lg'] evaluated to). Consumers passing the shortcut 'lg'/'md'/etc. to when keep working unchanged.

Other information

  • Author note: I'm also the author of the Stencil PR (ionic-team/stencil#6728) that surfaced this drift. This Ionic-side change is forward-compatible — it works against both the current and the new Stencil compiler — so it can land independently of any Stencil release.
  • Audit follow-up: a grep across core/src/components did not find any other @Prop default that uses an identifier / property / element access pattern, so IonSplitPane was the only affected component.

The `when` prop default was initialized from `QUERY['lg']`. Upcoming
Stencil compiler changes resolve such identifier/element-access default
initializers to their underlying literal in the generated
`components.d.ts`, producing a drift between the committed file and a
clean rebuild and breaking the Stencil Nightly Build.

Inline the literal `'(min-width: 992px)'` so both the current and
upcoming Stencil compiler emit identical output. Runtime behavior is
unchanged: the shortcut lookup `QUERY[query] || query` continues to
resolve user-supplied shortcuts (`'lg'`, `'md'`, etc.) via the `QUERY`
map.
@gnbm gnbm requested a review from a team as a code owner May 22, 2026 09:48
@gnbm gnbm requested a review from BenOsodrac May 22, 2026 09:48
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment May 22, 2026 2:05pm

Request Review

@gnbm
Copy link
Copy Markdown
Contributor Author

gnbm commented May 22, 2026

Closing this — thanks for the review feedback.

Summary of why this is not the right fix:

  • The Stencil Nightly Build failing on a components.d.ts diff is working as intended: it's a manual-review gate that surfaces every Stencil change that would alter generated output, so the change can be reviewed and accepted (or reverted) consciously rather than landing silently.
  • Resolving @Prop defaults to their underlying literal in the generated JSDoc (Stencil PR fix(compiler): resolve @Prop variable defaults to literal values in docs output stenciljs/core#6728) is an improvement to the docs comments in components.d.ts, not a regression to work around.
  • The correct path is to wait until @ionic/core bumps @stencil/core to a release containing that change, then commit the regenerated components.d.ts together with the bumped package.json / package-lock.json as one intentional review-able change.

The approach in this PR (inlining the literal so neither old nor new Stencil produces a diff) papers over the review signal and strips the readability of the QUERY['lg'] named constant in split-pane.tsx, so it's the wrong direction.

Closing and deleting the branch — no action needed in core today.

@gnbm gnbm closed this May 22, 2026
@gnbm gnbm deleted the fix/split-pane-when-default-literal branch May 22, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant