feat(astro): Register a route provider backed by the route meta tag - #23792
Draft
logaretm wants to merge 1 commit into
Draft
feat(astro): Register a route provider backed by the route meta tag#23792logaretm wants to merge 1 commit into
logaretm wants to merge 1 commit into
Conversation
The middleware already injects the parameterized route into the document it renders, but it was only readable from the pageload instrumentation. Registered from `init()` rather than the tracing integration, so route parameterization no longer depends on tracing being enabled. Not a matcher: the document only describes the page it rendered, so a URL other than the current one resolves to undefined rather than a guess. Verified against Astro 5.18 that `ClientRouter` swaps the tag during `astro:after-swap", at the same moment `location` changes, so reading it per call stays correct across soft navigations and back/forward.
Contributor
size-limit report 📦
|
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.
Registers a route provider for Astro from the
sentry-route-namemeta tag the middleware already injects into every rendered document.Registered from
init()rather than the tracing integration, so route parameterization no longer depends on tracing being enabled.Unlike the Next.js and Remix providers this is not a matcher. The document only ever describes the page it rendered, so a URL other than the current one resolves to
undefinedrather than a guess. That guard is also what stops a navigation being named after the route it is leaving.I checked the soft-navigation behaviour against Astro 5.18 with a throwaway app rather than assuming it.
ClientRouterswaps the tag duringastro:after-swap, at the same momentlocationchanges, and does not accumulate duplicates, so reading it per call stays correct across client-side navigations and back/forward. It is only stale during a navigation, before the swap, which the current-path guard already excludes.Part of #23556