Skip to content

Fix theme dev storefront host for preview stores#7667

Draft
alfonso-noriega wants to merge 1 commit into
store-list-commandfrom
theme-dev-preview-store-hosts
Draft

Fix theme dev storefront host for preview stores#7667
alfonso-noriega wants to merge 1 commit into
store-list-commandfrom
theme-dev-preview-store-hosts

Conversation

@alfonso-noriega
Copy link
Copy Markdown
Contributor

@alfonso-noriega alfonso-noriega commented May 29, 2026

WHY are these changes introduced?

Preview-store and local development can require separate URLs for Admin API, storefront rendering, theme editor, and shareable storefront preview access. theme dev previously had one store host and used it for all generated links and local rendering. That breaks prototype preview-store flows where the Admin API host is usable but browser-facing links need different routing or a backend-generated tokenized preview URL.

WHAT is this pull request doing?

  • Adds an optional storefrontFqdn to theme dev server sessions.
  • Keeps Admin API operations on storeFqdn, while SFR rendering/proxy/cookie-domain handling can use storefrontFqdn when explicitly provided.
  • Adds hidden theme dev --storefront-host / SHOPIFY_FLAG_STOREFRONT_HOST for experiments where storefront rendering differs from --store.
  • Adds hidden theme dev --preview-url / SHOPIFY_FLAG_PREVIEW_URL so preview-store flows can show/open a backend-generated preview URL instead of the standard ?preview_theme_id= URL.
  • Generates local dev-api editor links through the browser-facing admin host (admin.shop.dev/store/<shop>/themes/<theme>/editor) while preserving the original /admin/themes/... URL for normal stores.
  • Defaults to original behavior when no hidden overrides are provided.

How to test your changes?

Automated checks run locally:

pnpm vitest packages/theme/src/cli/services/dev.test.ts packages/theme/src/cli/utilities/theme-environment/storefront-renderer.test.ts packages/theme/src/cli/utilities/theme-environment/dev-server-session.test.ts --run
pnpm nx run theme:type-check
pnpm nx run theme:lint

Manual smoke test target:

shopify theme dev --store preview-<id>.dev-api.shop.dev --password <admin-api-token>

If a preview-store environment needs explicit storefront/preview routing, pass:

shopify theme dev --store preview-<id>.dev-api.shop.dev --storefront-host <storefront-host> --preview-url <backend-preview-url> --password <admin-api-token>

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — bump/changeset decision pending for prototype stack

Copy link
Copy Markdown
Contributor Author

alfonso-noriega commented May 29, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label May 29, 2026
@alfonso-noriega alfonso-noriega force-pushed the theme-dev-preview-store-hosts branch 2 times, most recently from 2a56df6 to a752730 Compare May 29, 2026 10:19
@alfonso-noriega alfonso-noriega force-pushed the theme-dev-preview-store-hosts branch from a752730 to 3424286 Compare May 29, 2026 12:33
@github-actions
Copy link
Copy Markdown
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/local-storage.d.ts
@@ -34,6 +34,19 @@ export declare class LocalStorage<T extends Record<string, any>> {
      * @throws BugError if an unexpected error occurs.
      */
     delete<TKey extends keyof T>(key: TKey): void;
+    /**
+     * Get every  pair currently held in the local storage.
+     *
+     * Useful for callers that need to enumerate all stored values without knowing the
+     * full set of keys in advance (for example, a  command iterating over every
+     * stored session). The  package stores its entire state as a single JSON
+     * object, so this is just a typed wrapper around that object.
+     *
+     * @returns An array of  tuples.
+     * @throws AbortError if a permission error occurs.
+     * @throws BugError if an unexpected error occurs.
+     */
+    entries(): [keyof T, T[keyof T]][];
     /**
      * Clear the local storage (delete all values).
      *

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant