diff --git a/apps/mobile/src/screens/settings/library/CloudSettings.tsx b/apps/mobile/src/screens/settings/library/CloudSettings.tsx index 5a94c652f..c4a44afac 100644 --- a/apps/mobile/src/screens/settings/library/CloudSettings.tsx +++ b/apps/mobile/src/screens/settings/library/CloudSettings.tsx @@ -1,5 +1,5 @@ import { CloudInstance, useLibraryContext, useLibraryMutation, useLibraryQuery } from '@sd/client'; -import { FlatList, Text, View } from 'react-native'; +import { ActivityIndicator, FlatList, Text, View } from 'react-native'; import Card from '~/components/layout/Card'; import Empty from '~/components/layout/Empty'; import ScreenContainer from '~/components/layout/ScreenContainer'; @@ -32,7 +32,7 @@ const Authenticated = () => { const { library } = useLibraryContext(); const authState = useAuthStateSnapshot(); - const cloudLibrary = useLibraryQuery(['cloud.library.get'], { suspense: true, retry: false }); + const cloudLibrary = useLibraryQuery(['cloud.library.get'], { retry: false }); const createLibrary = useLibraryMutation(['cloud.library.create']); const syncLibrary = useLibraryMutation(['cloud.library.sync']); @@ -44,6 +44,14 @@ const Authenticated = () => { (instance) => instance.uuid !== library.instance_id ); + if (cloudLibrary.isLoading) { + return ( + + + + ); + } + return ( {cloudLibrary.data ? ( @@ -61,7 +69,7 @@ const Authenticated = () => { )} - + Name {cloudLibrary.data.name} @@ -114,7 +122,7 @@ const Authenticated = () => { Instances - + { renderItem={({ item }) => } keyExtractor={(item) => item.id} numColumns={(cloudInstances?.length ?? 0) > 1 ? 2 : 1} - {...(cloudInstances?.length ?? 0) > 1 ? {columnWrapperStyle: tw`w-full justify-between`} : {}} + {...(cloudInstances?.length ?? 0) > 1 ? {columnWrapperStyle: tw`justify-between w-full`} : {}} /> @@ -195,8 +203,8 @@ const Login = () => { loggingIn: 'Cancel', } return ( - - + + To access cloud related features, please login diff --git a/apps/mobile/src/screens/settings/library/SyncSettings.tsx b/apps/mobile/src/screens/settings/library/SyncSettings.tsx index 3531c4ac4..41dc387df 100644 --- a/apps/mobile/src/screens/settings/library/SyncSettings.tsx +++ b/apps/mobile/src/screens/settings/library/SyncSettings.tsx @@ -21,9 +21,7 @@ const SyncSettingsScreen = ({ navigation }: SettingsStackScreenProps<'SyncSettin const [startBackfill, setStart] = useState(false); - useLibrarySubscription(['library.actors'], { onData: (data) => { - setData(data); - } }); + useLibrarySubscription(['library.actors'], { onData: setData}); useEffect(() => { if (startBackfill === true) {