-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Dev Console issues #5444
base: main
Are you sure you want to change the base?
Fix Dev Console issues #5444
Conversation
@@ -480,8 +480,12 @@ class AppLoader<TConfig extends AppConfiguration, TModuleSpec extends ExtensionS | |||
entryPath = await this.findEntryPath(directory, specification) | |||
} | |||
|
|||
const previousExtension = this.previousApp?.allExtensions.find((extension) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isaacroldan any ideas how to test this? I couldn't figure out how to write a test for reloadApp
. I tried writing one but it just aborts with the "Error loading the app, please check your app configuration." error.
@@ -126,17 +126,26 @@ export async function devUIExtensions(options: ExtensionDevOptions): Promise<voi | |||
const bundlePath = payloadOptions.appWatcher.buildOutputPath | |||
const payloadStoreRawPayload = await getExtensionsPayloadStoreRawPayload(payloadOptions, bundlePath) | |||
const payloadStore = new ExtensionsPayloadStore(payloadStoreRawPayload, payloadOptions) | |||
let extensions = payloadOptions.extensions | |||
|
|||
const getExtensions = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having a getExtensions
we could mutate payloadOptions.extensions
directly. Not sure if that's better though because it hides away the details. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like having an explicit "getExtensions" method 👌
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success2048 tests passing in 913 suites. Report generated by 🧪jest coverage report action from 066edbe |
Update dev console's extension instances when app reloads
df03c94
to
80a53da
Compare
const extensionInstance = new ExtensionInstance({ | ||
configuration, | ||
configuration: {...configuration, uid: previousExtension?.uid, devUUID: previousExtension?.devUUID}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't include this as part of the config, as the config is typed and the devUUID doesn't belong there.
Let's just update the extensionInstance after creating it
/snapit |
🫰✨ Thanks @vividviolet! Your snapshot has been published to npm. Test the snapshot by installing your package globally: pnpm i -g @shopify/[email protected] Tip If you get an Caution After installing, validate the version by running just |
WHY are these changes introduced?
This PR addresses 2 issues.
Mismatched ids
When connecting to the Dev Console, sometimes updates are lost due to mismatched
devUUID
after the ids are fetched from Partners. Here's how this happens:devUUID
generated from the handle, ex.dev-abc
updateExtensionUUIDS
is called with an updated uuid ofreal-uuid
reloadApp
to be calleddevUUID
generated from the handle, ex.dev-abc
. Since we don't callupdateExtensionUUIDS
again the real uuid gets lostupdate
event for the extensiondev-abc
dev-abc
doesn't matchreal-uuid
.Out of date extension instances
The Dev Console holds onto old extension instances that are never updated when the app reloads which causes a 404 error when visiting a target that was updated after the dev process has started. Here's how this happens:
[{target: 'admin.product-details.block.render']
[{target: 'admin.catalog-details.block.render']
which triggersreloadApp
to be called.hasExtensionPointTarget
is called on the old instance which doesn't have the new targetWHAT is this pull request doing?
Before
Screen.Recording.2025-02-21.at.8.44.13.PM.mov
After
Screen.Recording.2025-02-21.at.8.41.35.PM.mov
How to test your changes?
dev
and app with a Admin Block UI extensionPost-release steps
Measuring impact
How do we know this change was effective? Please choose one:
Checklist