@@ -4,6 +4,7 @@ import { Heading } from '@douglasneuroinformatics/libui/components';
44import { useTranslation } from '@douglasneuroinformatics/libui/hooks' ;
55
66import { PageHeader } from '@/components/PageHeader' ;
7+ import { WithFallback } from '@/components/WithFallback' ;
78import { useInstrumentInfoQuery } from '@/hooks/useInstrumentInfoQuery' ;
89import { useSetupState } from '@/hooks/useSetupState' ;
910import { useAppStore } from '@/store' ;
@@ -19,12 +20,15 @@ export const ManageGroupPage = () => {
1920 const changeGroup = useAppStore ( ( store ) => store . changeGroup ) ;
2021 const setupState = useSetupState ( ) ;
2122
22- const availableInstruments = instrumentInfoQuery . data ?? [ ] ;
23+ const availableInstruments = instrumentInfoQuery . data ;
2324
2425 const accessibleInstrumentIds = currentGroup ?. accessibleInstrumentIds ;
2526 const defaultIdentificationMethod = currentGroup ?. settings . defaultIdentificationMethod ;
2627
27- const { availableInstrumentOptions, initialValues } = useMemo ( ( ) => {
28+ const data = useMemo ( ( ) => {
29+ if ( ! availableInstruments ) {
30+ return null ;
31+ }
2832 const availableInstrumentOptions : AvailableInstrumentOptions = {
2933 form : { } ,
3034 interactive : { } ,
@@ -69,16 +73,15 @@ export const ManageGroupPage = () => {
6973 { t ( 'manage.pageTitle' ) }
7074 </ Heading >
7175 </ PageHeader >
72-
73- < ManageGroupForm
74- data = { {
75- availableInstrumentOptions,
76- initialValues
77- } }
78- readOnly = { Boolean ( setupState . data ?. isDemo && import . meta. env . PROD ) }
79- onSubmit = { async ( data ) => {
80- const updatedGroup = await updateGroupMutation . mutateAsync ( data ) ;
81- changeGroup ( updatedGroup ) ;
76+ < WithFallback
77+ Component = { ManageGroupForm }
78+ props = { {
79+ data,
80+ onSubmit : async ( data ) => {
81+ const updatedGroup = await updateGroupMutation . mutateAsync ( data ) ;
82+ changeGroup ( updatedGroup ) ;
83+ } ,
84+ readOnly : Boolean ( setupState . data ?. isDemo && import . meta. env . PROD )
8285 } }
8386 />
8487 </ React . Fragment >
0 commit comments