-
Notifications
You must be signed in to change notification settings - Fork 140
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
Make developer console support create/delete extensions mid-dev #5118
base: main
Are you sure you want to change the base?
Make developer console support create/delete extensions mid-dev #5118
Conversation
Coverage report
Show files with reduced coverage 🔻
Test suite run success1989 tests passing in 898 suites. Report generated by 🧪jest coverage report action from 303d315 |
this.handle = this.buildHandle() | ||
this.devUUID = `dev-${nonRandomUUID(this.handle)}` |
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.
With this we ensure that the devUUID
is always the same for the same extension. Allowing us to reload it if we need it.
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.
Noting that the handle can change (right?) so it's not 100% foolproof but it's close enough that it should be fine.
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.
It shouldn't change during dev
though, which solves the issue of "reloading" the app.
In any case, this is mostly for ui-extensions, and we need to rethink why ui-extensions need a devUUID
in the first place. Will probably do it in early january.
this.handle = this.buildHandle() | ||
this.devUUID = `dev-${nonRandomUUID(this.handle)}` |
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.
Noting that the handle can change (right?) so it's not 100% foolproof but it's close enough that it should be fine.
// NOTE: Always use `payloadOptions`, never `options` directly. This way we can mutate `payloadOptions` without | ||
// affecting the original `options` object and we only need to care about `payloadOptions` in this function. |
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.
Note that we could make options
of type Readonly<ExtensionDevOptions>
but there are also downsides as Readonly
is a somewhat weak guarantee and might make us think code is safe when it really isn't. Not a mandatory change, but something to consider.
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.
Actually, I just forced all other functions to expect a ExtensionsPayloadStoreOptions
, that way i'm sure we are using payloadOptions
outputDebug( | ||
`Failed to build a cart URL for your checkout extension. Use the --checkout-cart-url flag to set a fixed URL.`, | ||
payloadOptions.stdout, | ||
) |
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.
It seems like this is a unique error case because in the general case, if something fails inside buildCartURLIfNeeded
, we can just crash dev and no harm done. I'm curious why we wouldn't:
- Crash
dev
in this case - Keep going and just not provide the convenience link
Also, why would it not work? I guess just because:
- Connection to the store fails
- There are no products to test on
These feel like rare cases. 1 would be very odd given that we have other polling processes, and 2 would be odd not to crash or at least warn that no products exist. Note that the error message is raised inside fetchProductVariant
so I'd expect we should at least display it.
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.
Yeah, I wasn't sure how to handle this case, there are two main possibilities why this might fail:
- There are no products
- You don't have permissions to access the admin API to fetch products
I don't think we should stop dev
, as everything else works, the extension will work, what won't work is the "deeplink" to it... if you create a cart manually you'll see the extension.
Maybe instead of showing anything we should change the deeplink to take you to your store main page if there is no product here?
What do you think?
We detected some changes at packages/*/src and there are no updates in the .changeset. |
WHY are these changes introduced?
Adds support for handling extension creation and deletion events in the developer console during consistent-dev.
Fixes https://github.com/Shopify/develop-app-outer-loop/issues/1198
WHAT is this pull request doing?
KNOWN ISSUES:
How to test your changes?
Measuring impact
Checklist