Closed nullndr closed 4 months ago
Hi @nullndr,
Is this being used within a React app? If so, try setting loading=""
instead. React has some issues with custom boolean types on web components.
As an aside, we've just released App Bridge React v4 with a Modal component that wraps the ui-modal
element! https://shopify.dev/docs/api/app-bridge-library/react-components/modal
@charlesdobson yes, this is for a React app. I'll try the new package.
I bumped the @shopify/app-bridge-types
package with better support for this.
You may still need to use the loading=""
workaround in React though.
loading=""
will make the button spinning.
Now how would I implement the loading state conditionally? Like clicking on the primary button doing something which set a loading state true
so the primary button is showing spinner.
Currently with "@shopify/app-bridge-react": "4.1.3"
if I add loading="false"
to the button, it's showing the following error:
@maruffahmed this is ugly, but seems to be working: loading={workInProgress ? "" : undefined}
.
Consider the following simple code:
The modal will be displayed, but with the following warning:
Let's try with
loading="true"
then:The modal can not be shown with the
show()
method sincethis
isundefined
: