fix: my apps link 404 in production - #2529
Conversation
Replace the fragile req.url exact-match with the catch-all route's
query.slug to detect the /marketplace/register/ and /marketplace/installed/
virtual pages, since req.url could be altered by the production
reverse proxy/CDN in a way local dev never hit. Render these two pages
client-only (next/dynamic, ssr: false) since they read
getCookie('ZESTY_WORKING_INSTANCE') directly in render, which caused
SSR/CSR hydration mismatches once the page stopped 404ing.
Also switch installed/register pages to read the working instance from
the Zustand store instead of the cookie directly, so they update
reactively when the instance switcher changes it without a full page
reload (previously required a manual refresh).
Fix a regression this surfaced in store/index.js: getInstanceZUID()'s
fallback treated any URL's third path segment as an instance ZUID,
which produced a bogus truthy value ("installed") on
/marketplace/installed/ when no instance was actually selected. Scope
it to /instances/{zuid}/... routes only.
Fixes #2524
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ReviewSolid, well-scoped bug fix. The rationale in the PR description matches the code changes cleanly, and each of the four edits addresses a real issue rather than incidental cleanup. Strengths
Observations / follow-ups (non-blocking)
|
Resolves #2524
Summary
req.urlexact-match (used to detect the virtual/marketplace/register/and/marketplace/installed/pages) with a check on the catch-all route's ownquery.slug, sincereq.urlcould be altered by the production reverse proxy/CDN in a way local dev never hit — this was the root cause of the 404 in production.RegisterPage/InstalledPageclient-only (next/dynamic,ssr: false) since both readgetCookie('ZESTY_WORKING_INSTANCE')directly during render, which caused SSR/CSR hydration mismatches once the page stopped 404ing.useZestyStore((state) => state.workingInstance)) instead of the cookie directly, so they update reactively when the instance switcher changes it, without requiring a manual page refresh.src/store/index.js:getInstanceZUID()'s fallback treated any URL's third path segment as an instance ZUID, which produced a bogus truthy value ("installed") on/marketplace/installed/when no instance was actually selected. Scoped the fallback to/instances/{zuid}/...routes only.Test plan
/marketplace/installed/and/marketplace/register/directly and confirm no hydration mismatch warnings in the console./marketplace/installed/and confirm the installed apps list updates without a manual refresh./marketplace/installed/and confirm it shows "Please Select an Instance to Continue" rather than "No Data".Screenshots
Recording.2026-07-28.134121.mp4