Fix: normalize cached store URL before comparison in storeContext#7019
Fix: normalize cached store URL before comparison in storeContext#7019isaacroldan wants to merge 1 commit intomainfrom
Conversation
The cached dev_store_url from app.toml or hidden config was compared against the already-normalized selectedStore.shopDomain without first normalizing it. This meant format differences (e.g. 'https://store.myshopify.com' vs 'store.myshopify.com', or 'store' vs 'store.myshopify.com') would cause a false mismatch and trigger unnecessary writes to .shopify/project.json on every `dev` run. Now we normalize cachedStoreURL before comparing, so the hidden config is only updated when the store actually changes.
|
We detected some changes at Caution DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release. |
There was a problem hiding this comment.
Pull request overview
This PR fixes repeated hidden-config updates during dev runs by normalizing the cached dev_store_url (from app.toml or hidden config) before comparing it to the normalized selectedStore.shopDomain, avoiding false mismatches due to formatting differences.
Changes:
- Normalize
cachedStoreURLvianormalizeStoreFqdnbefore comparing to the selected store. - Add test coverage for format-only differences (protocol prefix, short store name) and for actual store changes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/app/src/cli/services/store-context.ts | Normalizes cached store URL before comparison to prevent unnecessary hidden-config writes. |
| packages/app/src/cli/services/store-context.test.ts | Adds tests ensuring hidden config is not updated for format-only differences and is updated when the store changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const hiddenConfig = await readFile(appHiddenConfigPath(dir)) | ||
| // The file was initialized empty, so if updateHiddenConfig was NOT called, | ||
| // it should still be empty | ||
| expect(hiddenConfig).toEqual('') | ||
| }) |
| vi.mocked(fetchStore).mockResolvedValue(storeMatchingNormalized) | ||
|
|
||
| await storeContext({appContextResult: updatedAppContextResult, forceReselectStore: false}) | ||
|
|
||
| // The hidden config should NOT be updated since normalized URLs match | ||
| const hiddenConfig = await readFile(appHiddenConfigPath(dir)) | ||
| expect(hiddenConfig).toEqual('') |
Coverage report
Test suite run success3814 tests passing in 1473 suites. Report generated by 🧪jest coverage report action from 71274f0 |
The cached dev_store_url from app.toml or hidden config was compared against the already-normalized selectedStore.shopDomain without first normalizing it. This meant format differences (e.g. 'https://store.myshopify.com' vs 'store.myshopify.com', or 'store' vs 'store.myshopify.com') would cause a false mismatch and trigger unnecessary writes to .shopify/project.json on every
devrun.Now we normalize cachedStoreURL before comparing, so the hidden config is only updated when the store actually changes.
WHY are these changes introduced?
Fixes #0000
WHAT is this pull request doing?
How to test your changes?
Post-release steps
Measuring impact
How do we know this change was effective? Please choose one:
Checklist