Conversation
a100399 to
2246893
Compare
| // New files won't be in the watched-files snapshot yet, so fall back to | ||
| // matching the path against each extension's directory. `shouldIgnoreEvent` | ||
| // still applies gitignore and per-extension patterns afterwards. | ||
| const owningExtension = this.app.realExtensions.find((ext) => { |
There was a problem hiding this comment.
This won't work for extensions sharing assets. Maybe we could inspect the extension's config and see if the file path matches anything that was configured for the extension?
2246893 to
bae6a0f
Compare
bae6a0f to
256ec29
Compare
There was a problem hiding this comment.
Pull request overview
This PR improves the dev file-watcher so newly created files (especially assets) can be attributed to the correct extension even when they weren’t present in the initial “watched files” snapshot, enabling more reliable hot reloading behavior.
Changes:
- Add a fallback path-to-extension ownership resolution when an event arrives for a file not present in the initial
extensionWatchedFilessnapshot. - Attempt ownership resolution by checking configured
extension_points[].assetsdirectories first, then extension directory containment. - Add tests covering the new “unknown file” directory-containment fallback behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/app/src/cli/services/dev/app-events/file-watcher.ts | Adds fallback extension ownership detection for newly created/unknown files (assets dirs + extension dir containment). |
| packages/app/src/cli/services/dev/app-events/file-watcher.test.ts | Adds tests validating the new fallback behavior for new files under an extension dir and ignored paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const extensionPoints = (ext.configuration as {extension_points?: {assets?: string}[]})?.extension_points | ||
| if (extensionPoints) { | ||
| const matchesAssetDir = extensionPoints.some((ep) => { | ||
| if (!ep.assets) return false | ||
| const assetDir = normalizePath(joinPath(ext.directory, ep.assets)) |
There was a problem hiding this comment.
@vividviolet what do you think about this? It seems like we actually don't support watching external folders outside of the extension folder ATM so a shared asset folder won't actually be watched.
| for (const owningExtension of owningExtensions) { | ||
| this.handleEventForExtension( | ||
| event, | ||
| path, | ||
| normalizePath(owningExtension.directory), | ||
| startTime, |
| describe('new file directory containment fallback', () => { | ||
| test('new file under an existing extension dir triggers file_created with the correct extensionHandle', async () => { | ||
| // Given: extension started with no files in assets/ — the new path is not in the snapshot | ||
| const ext = await testUIExtension({ | ||
| type: 'ui_extension', |
256ec29 to
40fc5df
Compare
40fc5df to
a36330a
Compare

WHY are these changes introduced?
Related to https://app.graphite.com/github/pr/shop/world/666583
Issue https://github.com/shop/issues-admin-extensibility/issues/2461
WHAT is this pull request doing?
I opened https://app.graphite.com/github/pr/shop/world/666583 in web to react to updated timestamps on assets served from the dev server, but we were still not watching new files. This PR
How to test your changes?
Demo of testing two images with name changes:
https://share.descript.com/view/bV9Pt8wvK6F
04-30-watch_assets_for_hot_reloading04-29-preserve_timestamp_on_asset_src_and_bust_cache_when_asset_changesin admin-webui-ext-hosted-jam(in ShopifyPlayground)Post-release steps
Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add