You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to set up some UI to edit some values in Shopify Functions. The tutorial provides some code like this for submitting the form to update the values of metafields to use in my discount logic:
However, nothing happens at all in the PageActions component when I click "Save Discount". It seems like onAction prop does not do anything and the documentation for Polaris does not even acknowlege onAction as an available prop despite it being used in the Shopify Functions discount tutorial. I'm expecting it to run the code of the onSubmit property returned from the useForm hook, however it does not log anything in the browser or terminal. What am I missing? Thank you.
Expected behavior
Clicking the "Save Discount" button that the <PageActions> component renders should log the form data and "'i am sumbitting the form"
Actual behavior
Nothing happens at all. No log in browser or terminal. It seem the onAction prop does not do anything. Even passing a callback function directly to the prop does nothing.
Steps to reproduce
Add a PageActions component to a Layout in Polaris.
Pass any value to onAction prop, even something as simple as this:
@aveline dropping this exact code in my project does not trigger the event as it does it your sandbox environment. I'm working on my app while running shopify app dev from my terminal, which displays the interface in the "Apps" section of the admin. Are there special considerations that need to be made when developing this way?
Summary
I've been trying to set up some UI to edit some values in Shopify Functions. The tutorial provides some code like this for submitting the form to update the values of metafields to use in my discount logic:
I'm trying to setup the simplest form possible to submit metafields relevant to my discount logic. I was trying to get a simple POC like this to work:
However, nothing happens at all in the PageActions component when I click "Save Discount". It seems like
onAction
prop does not do anything and the documentation for Polaris does not even acknowlegeonAction
as an available prop despite it being used in the Shopify Functions discount tutorial. I'm expecting it to run the code of the onSubmit property returned from theuseForm
hook, however it does not log anything in the browser or terminal. What am I missing? Thank you.Expected behavior
Clicking the "Save Discount" button that the
<PageActions>
component renders should log the form data and "'i am sumbitting the form"Actual behavior
Nothing happens at all. No log in browser or terminal. It seem the
onAction
prop does not do anything. Even passing a callback function directly to the prop does nothing.Steps to reproduce
PageActions
component to a Layout in Polaris.onAction
prop, even something as simple as this:Are you using React components?
Yes
Polaris version number
13.9.0
Browser
Chrome
Device
Macbook Pro Sanoma 14.4
The text was updated successfully, but these errors were encountered: