Skip to content

feat(site/src/pages/TemplateBuilder): deep-link base template via query param - #26808

Closed
jeremyruppel wants to merge 2 commits into
mainfrom
jeremy/devex-557-deeplink-to-base-template
Closed

feat(site/src/pages/TemplateBuilder): deep-link base template via query param#26808
jeremyruppel wants to merge 2 commits into
mainfrom
jeremy/devex-557-deeplink-to-base-template

Conversation

@jeremyruppel

Copy link
Copy Markdown
Contributor

Adds support for a ?base=<id> query parameter on /templates/new/builder that preselects a base template and advances the wizard to the next available step (base parameters if applicable, otherwise module select).

Changes

  • wizardState.ts: Move toSelectedBaseMeta here as a shared data mapper between the API TemplateBuilderBase type and the UI SelectedBaseMeta type.
  • BaseInfraSelectStep.tsx: Import toSelectedBaseMeta from wizardState instead of defining it locally.
  • TemplateBuilderPage.tsx: Read the ?base search param. When present, wait for bases data to load, resolve the matching base, and pass it as a preselectedBase prop.
  • TemplateBuilderPageView.tsx: Accept preselectedBase prop. Use it to initialize wizard reducer state and starting step index at mount time (no effects or refs needed).

Example

/templates/new/builder?base=docker opens the wizard with Docker preselected, landing on base parameters or module select depending on the base.

Generated by Coder Agents

@linear-code

linear-code Bot commented Jun 29, 2026

Copy link
Copy Markdown

DEVEX-557

…ry param

Add support for a `?base=<id>` query parameter on `/templates/new/builder`
that preselects a base template and advances the wizard to the next
available step (base parameters if applicable, otherwise module select).

- Move `toSelectedBaseMeta` from `BaseInfraSelectStep` to `wizardState`
  as a shared data mapper.
- In `TemplateBuilderPage`, read the `?base` search param and resolve
  it against the bases query before rendering the view.
- In `TemplateBuilderPageView`, accept a `preselectedBase` prop and
  use it to initialize reducer state and step index.
@jeremyruppel
jeremyruppel force-pushed the jeremy/devex-557-deeplink-to-base-template branch from d88209d to 6108fc5 Compare June 30, 2026 13:30
@jeremyruppel
jeremyruppel requested a review from code-asher June 30, 2026 23:48

@code-asher code-asher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not run it but it looks reasonable to me!

One downside is that I think without a query param we would get the outline rendered and then as the bases query loads we get another loader inside the select step?

But now if you set ?base then you get the higher-level loader even though it is still the same query you are waiting for.

Not a big deal by any means but maybe there is a case to be made for a bit of a refactor where we pass in the query param and the state stores just the ID rather than needing the whole base up front (unless this is a big lift).

jeremyruppel added a commit that referenced this pull request Jul 8, 2026
Add a ?base=<baseId> query param that preselects a base template when
entering the wizard. The page container resolves the base from the API
before mounting the view, then passes it as preselectedBase. The view
initializes the reducer with the base already selected and defaults to
the next step past base-infra when no explicit ?step= param is present.

Also moves toSelectedBaseMeta from BaseInfraSelectStep to wizardState so
both the page container and the step component can reuse it.

Supersedes #26808.
@github-actions github-actions Bot added the stale This issue is like stale bread. label Jul 9, 2026
@github-actions github-actions Bot closed this Jul 13, 2026
jeremyruppel added a commit that referenced this pull request Jul 14, 2026
#27104)

Browser back/forward controls did not work in the template builder
wizard. Using browser navigation sent the user out of the wizard
entirely instead of moving between steps.

The wizard's current step is now driven by a `?step=` search param. Step
transitions push history entries so browser back/forward walks the
steps. Steps that are invalid, skipped, or unreachable given the wizard
state are clamped and the URL is rewritten with a replace, keeping URL
and state in sync in both directions.

`?base=` is accepted as the only entry search param and deep-links to a
preselected base template (superseding #26808). The page container
resolves it against the available bases, holds the wizard behind a
loader until it is consumed and removed from the URL, then mounts the
wizard starting on the first step after base selection.

Closes https://linear.app/codercom/issue/DEVEX-594

> Generated with [Coder](https://coder.com) by @jeremyruppel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale This issue is like stale bread.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants