Fix offline query parameter handling in embed route#100
Open
Fix offline query parameter handling in embed route#100
Conversation
Co-authored-by: scaryrawr <661373+scaryrawr@users.noreply.github.com>
Co-authored-by: scaryrawr <661373+scaryrawr@users.noreply.github.com>
Co-authored-by: scaryrawr <661373+scaryrawr@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix embed route query parameters for offline mode
Fix offline query parameter handling in embed route
Jan 27, 2026
There was a problem hiding this comment.
Pull request overview
This PR fixes offline query parameter handling in the embed route by normalizing cache keys to exclude query parameters. Previously, visiting embed.html?trainType=c51 would fail offline if only embed.html was cached, despite the HTML content being identical.
Changes:
- Added
createRequestWithoutQueryhelper function to strip query parameters from Request objects - Modified navigation request caching to store responses without query parameters
- Updated offline cache matching to search without query parameters
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Query parameters to the embed route (
?trainType=c51&messages=["hello"]) fail in offline mode if the exact URL wasn't previously cached. Service worker performs literal cache key matching including query strings.Changes
Strip query parameters for navigation request caching: Cache keys normalized by removing query strings since HTML content is identical. JavaScript reads parameters from
window.location.searchat runtime.Extract
createRequestWithoutQueryhelper: Eliminates duplication between online caching and offline matching logic. Short-circuits when no query parameters exist.Result: Visiting
embed.htmlonline enablesembed.html?trainType=c51&messages=["test"]offline.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.