mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-30 21:01:54 +08:00
Reset export scope to default each time the dialog opens
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
c7b8651b7d
commit
5ca25b1eb9
@ -67,6 +67,17 @@ export function DataGridExportDialog<TRow>({
|
||||
}
|
||||
}, [isExporting, resolvedFields]);
|
||||
|
||||
// Reset the scope to its default each time the dialog opens. The dialog stays
|
||||
// mounted between opens, so without this the scope would retain whatever the
|
||||
// user last picked instead of honoring `defaultScope` on every open. We key
|
||||
// off `open` so this only fires on an open transition.
|
||||
const defaultScope = exportOptions?.defaultScope ?? "all";
|
||||
useEffect(() => {
|
||||
if (open && !isExporting) {
|
||||
setScope(defaultScope);
|
||||
}
|
||||
}, [open, isExporting, defaultScope]);
|
||||
|
||||
const entityName = exportOptions?.entityName ?? "row";
|
||||
const entityNamePlural = exportOptions?.entityNamePlural ?? "rows";
|
||||
const filenamePrefix = exportOptions?.filenamePrefix ?? exportFilename;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user