fix depth exceeded warning

This commit is contained in:
ppc
2024-08-21 21:49:55 +01:00
parent 819c91ac52
commit 3410ac67d7
+8 -7
View File
@@ -18,7 +18,7 @@ export default function ServerAddModal({route, navigation}) {
// add option to add server address when loading a share link
useEffect(() => {
handleDeepLink(realm, navigation, route, setServerAddress);
}, [route]);
}, []);
useLayoutEffect(() => {
navigation.setOptions({
@@ -97,14 +97,15 @@ function handleDeepLink(realm, navigation, route, setAddress: (address: string)
const item = realm.objects(AMServer).filtered("serverAddress = $0", serverUrl);
if (item.length) {
// clear modal without animating it
navigation.setOptions({animation: "none"});
navigation.goBack();
navigation.navigate('server', {
serverId: item._id.toHexString()
});
// allow the homepage to render before moving on
setTimeout(() => navigation.navigate('server', {
serverId: item[0]._id.toHexString()
}), 1000);
} else {
setAddress(serverUrl);
}
// clear param from route
navigation.setParams({serverAddress: null});
}