I've encountered an issue with the Toast component in Shopify App Bridge: the onAction event does not trigger after clicking the action button. This occurs in the following scenario:
To Reproduce
Steps to reproduce the behavior:
Declare the Toast instance:
import { Toast } from '@shopify/app-bridge/actions';
Describe the bug
I've encountered an issue with the Toast component in Shopify App Bridge: the onAction event does not trigger after clicking the action button. This occurs in the following scenario:
To Reproduce
Steps to reproduce the behavior:
const app = createApp({ apiKey: 'API_KEY', host: 'HOST', forceRedirect: true, });
const toastInstance = Toast.create(app, { message: 'User has been successfully deleted!', duration: 3000, action: { content: 'Undo', onAction: () => { console.log(1); }, }, })
The toast displays correctly, and the 'Undo' link appears. However, clicking on 'Undo' results in no action.
Expected behaviour
Clicking on 'Undo' should trigger the onAction method, which in my case would log to the console.
Contextual information
Packages and versions
@shopify/app-bridge
@^3.7.9
Platform