Fix theme dev shortcut to editor tracking non page requests#6924
Fix theme dev shortcut to editor tracking non page requests#6924EvilGenius13 wants to merge 1 commit intomainfrom
Conversation
|
Claude review: PR #6924: Fix theme dev shortcut to editor tracking non page requestsSummary: Good bug fix. The approach of using Issue 1:
|
4eec082 to
ae77bc6
Compare
|
Thanks for the claude review @tyleralsbury. 🤦 on the |
Coverage report
Test suite run success3789 tests passing in 1448 suites. Report generated by 🧪jest coverage report action from ae77bc6 |
|
🤖 Code Review · #projects-dev-ai for questions ✅ Complete - No issues 📋 History✅ No issues |
WHY are these changes introduced?
Fixes https://community.shopify.dev/t/shopify-cli-theme-dev-editor-shortcut-loading-ajax-url/29157/5
When running
theme dev, non-navigational requests like AJAX/fetch requests could be tracked as thelastRequestedPath. This caused the theme editor (E) shortcut to open the editor pointing to an AJAX endpoint (e.g., /cart/add.js or section URL instead of the actual page the user was viewing.WHAT is this pull request doing?
Use
Sec-Fetch-ModeHTTP header to update thelastRequestedPathonly if it's anavigationtype (like clicking links, typing a URL in the address bar)How to test your changes?
You can replicate the issue by making a new file
/layout/product.ajax-test.liquidand add this codeDetails
Then edit your
layout/theme.liquidby adding this codeRun theme dev, navigate to a product page and then try the shortcut key to the editor. You should get an error.
Afterwards, build and run this branch and try the same thing, you should see the product page as expected.
Post-release steps
Measuring impact
How do we know this change was effective? Please choose one:
Checklist