poc: create dialog stackable system compatible with router and promises #1495
+1,998
−19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Dialog System Usage Guide
Contributes to https://github.com/Shopify/oasis-frontend/issues/393
Type of Change
Motivation
Existing Dialog system is based on using and managing components in place. This causing a lot of friction:
ComponentDuplicateDialogManageLibrariesDialog)Key Features
Screen Recording 2025-12-06 at 5.33.55 PM.mov (uploaded via Graphite)
Overview
The dialog system provides an imperative, async/await API for managing dialogs with full router integration. Dialogs are rendered in a stack, allowing nested dialogs with automatic back navigation.
Basic Usage
Opening a Custom Dialog
Any component can be a dialog. It receives
closeandcancelprops:Handling Cancellation with DialogCancelledError
For more precise error handling, use
DialogCancelledError:Dialog with Additional Props
For dialogs that need extra props beyond
closeandcancel:Creating a Reusable Confirmation Hook
You can create custom hooks for common dialog patterns:
Router Integration
When you provide a
routeKey, the dialog URL will be synchronized:?dialog=your-route-key&dialogId=abc123Dialog Stacking
Dialogs can be opened from within other dialogs, creating a stack:
DialogCancelledError)Using with TanStack Query (useMutation)
The dialog system works well with TanStack Query mutations:
Dialog Options
componentComponentType<DialogProps<T, TProps>>propsTProps{}routeKeystringsize'sm' | 'md' | 'lg' | 'xl' | 'full''md'closeOnEscbooleantruecloseOnOverlayClickbooleantrueSize Classes
sm:max-w-sm(~384px)md:max-w-lg(~512px)lg:max-w-2xl(~672px)xl:max-w-4xl(~896px)full:max-w-[90vw]API Reference
useDialog()
Main hook for working with dialogs:
DialogProps<T, TProps>
Props passed to every dialog component:
DialogCancelledError
Error thrown when a dialog is cancelled:
Migration from Old System
Before (Old System)
After (New System)