fix(storyblok-ui): resolve story multilinks to the target's current slug - #2661
Merged
Merged
Conversation
`multilinkHref` preferred the multilink's `cached_url`, which Storyblok freezes at the moment the *referencing* story is published. Renaming the target story does not rewrite it in already-published content, so every link to the renamed story kept emitting the old URL — a 404 — until an editor re-published each referencing story. `story.full_slug` is injected by `@storyblok/react` from the `links` map the CDN builds from the live story index on every request, and `sbParams` already sends `resolve_links: 'story'` on all reads, so it is populated for story links and always current. Prefer it, and fall through unchanged for `url` / `email` / `asset` links, which have no resolved story. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: c849720 The changes in this PR will be included in the next version bump. This PR includes changesets to release 86 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Written by Claude Code:
A
storymultilink carries the target twice, and only one of the two is current:cached_urlfull_slugas it was when the referencing story was last published. Renaming the target does not rewrite it in already-published content.story.full_slug@storyblok/reactfrom thelinksmap the CDN builds from the live story index on every request.sbParamsalready sendsresolve_links: 'story'on all reads, so it is populated for every story link.multilinkHrefpreferredcached_url, so renaming a story left every link to it emitting the old URL — a 404 — until an editor re-published each referencing story individually. That is easy to miss for links in a shared global-config story: the config is embedded in each page'sgetStaticPropsoutput, so the stale href also lingers per page for as long as that page's ISR entry lives, making the same link appear broken on some routes and fine on others.This PR prefers the resolved
story.full_slugforlinktype: 'story', which makes story links self-healing across renames — no re-publish of referencing stories needed.url/email/assetlinks have no resolved story and fall through to the existing behaviour unchanged.Found on a production storefront where the footer's "Retourneren" link pointed at
/klantenservice/Retournerenafter the target story had been renamed to lowercaseretourneren.🤖 Generated with Claude Code