I’m using to host a complex editor (React + react-hook-form) and trying to wire shopify.saveBar for unsaved-changes UX. I’ve hit three issues I haven’t been able to work around - would appreciate guidance or confirmation if these are known limitations.
Setup
// inside the s-app-window content route
<ui-save-bar id="editor-save-bar">
<button variant="primary" onClick={handlePublish}>Publish</button>
<button onClick={handleDiscard}>Discard</button>
</ui-save-bar>
useEffect(() => {
if (isDirty) shopify.saveBar.show("editor-save-bar");
else shopify.saveBar.hide("editor-save-bar");
}, [isDirty]);
Issue 1 - No leave/close confirmation from the s-app-window
When the save bar is visible (dirty state) and the merchant clicks the app window’s close button, the window closes immediately without prompting. The documented behavior for data-save-bar is to prompt before exit - but the programmatic shopify.saveBar.show() path doesn’t seem to participate in the close flow at all.
Is there an API to register an “about-to-close” handler on , or a way to make the programmatic save bar block the close the way data-save-bar does
for form-based pages?
Issue 2 - data-save-bar isn’t usable when state is set programmatically
The docs recommend data-save-bar on a for automatic dirty tracking. We can’t use it: our form state is managed by react-hook-form, which updates values via setValue() (React state) rather than firing native input/change events on DOM elements. The save bar never detects mutations.
Is there a supported way to manually signal “the form is dirty” to a data-save-bar form (e.g., dispatch a synthetic event, set an attribute), so we can still benefit from the auto leave-confirmation behavior described in Issue 1?
Issue 3 - loading and disabled on buttons inside are ignored
PublishNeither loading nor disabled has any visible effect on the Save button. Users can spam-click during the publish request. Is there a different prop name, or is this expected and we need to gate clicks in JS only?
Environment
- App Bridge: latest
- React 18 + Remix
- App is embedded in Shopify admin