Skip to content

Commit e31f100

Browse files
committed
fix(ui): handle sheet reference readiness in showSheet function
1 parent 2452cf7 commit e31f100

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/store/utils/ui.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ export const showSheet = <Id extends keyof SheetsParamList>(
1919
): void => {
2020
const [id, params] = args;
2121
const sheetRef = getSheetRefOutsideComponent(id);
22-
sheetRef.current?.present(params);
22+
23+
if (!sheetRef.current) {
24+
// sheetRef not ready, try again after a short wait
25+
// NOTE: needed for deeplinks when app is closed
26+
setTimeout(() => showSheet(...args), 100);
27+
} else {
28+
sheetRef.current?.present(params);
29+
}
2330
};
2431

2532
export const closeSheet = async (id: SheetId): Promise<void> => {

0 commit comments

Comments
 (0)