-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backups V2 Follow-up Fixes / Improvements #6213
Draft
walmat
wants to merge
24
commits into
develop
Choose a base branch
from
@matthew/APP-1297
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
c035b9f
remove useState that is getting wiped between renders
walmat ea2fd09
lots of provider structure changes
walmat 3735f81
Merge branch 'develop' into @matthew/APP-1297
walmat 4afed74
lots more progress on restructuring and code sharing
walmat fb913bc
more code quality improvements
walmat afc42bf
prevent App.tsx from re-rendering unless it needs to
walmat 6946626
fix password not being pulled from local password keychain and add lo…
walmat 9ea81dd
misc backups improvements
walmat fd16a13
Update .vscode/settings.json
walmat 00d1bff
cleanup
walmat 7016d47
Merge branch '@matthew/APP-1297' of https://github.com/rainbow-me/rai…
walmat 5420054
fix lint
walmat c20670c
Merge branch 'develop' into @matthew/APP-1297
walmat 5784cb2
fix overlay causing top leve re-renders
walmat 0c81b5f
nav back to wallet screen on both new user restore / existing restore
walmat 1fadaf5
convert cloud backup provider to zustand store, remove userData as it…
walmat a9948af
lots of cleanup
walmat 5c5a848
add icon to indicate wrogn backup password
walmat 6d7b6fa
simplify prompt to backup selected wallet
walmat 9823919
more manual backup to cloud backup transitions
walmat 7b18523
Update src/components/backup/RestoreCloudStep.tsx
walmat 1f42ab9
reset backup provider to undefined if no condition is met
walmat 466f3dc
adjust logic for displaying backed up status on Android when switchin…
walmat 461ee79
more android tweaks
walmat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import '@/languages'; | ||
import * as Sentry from '@sentry/react-native'; | ||
import React, { useCallback, useEffect, useState } from 'react'; | ||
import React, { useCallback, useEffect, useState, memo } from 'react'; | ||
import { AppRegistry, Dimensions, LogBox, StyleSheet, View } from 'react-native'; | ||
import { Toaster } from 'sonner-native'; | ||
import { MobileWalletProtocolProvider } from '@coinbase/mobile-wallet-protocol-host'; | ||
|
@@ -9,7 +9,7 @@ import { useApplicationSetup } from '@/hooks/useApplicationSetup'; | |
import { GestureHandlerRootView } from 'react-native-gesture-handler'; | ||
import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context'; | ||
import { enableScreens } from 'react-native-screens'; | ||
import { connect, Provider as ReduxProvider } from 'react-redux'; | ||
import { connect, Provider as ReduxProvider, shallowEqual } from 'react-redux'; | ||
import { RecoilRoot } from 'recoil'; | ||
import PortalConsumer from '@/components/PortalConsumer'; | ||
import ErrorBoundary from '@/components/error-boundary/ErrorBoundary'; | ||
|
@@ -22,7 +22,7 @@ import * as keychain from '@/model/keychain'; | |
import { Navigation } from '@/navigation'; | ||
import { PersistQueryClientProvider, persistOptions, queryClient } from '@/react-query'; | ||
import store, { AppDispatch, type AppState } from '@/redux/store'; | ||
import { MainThemeProvider, useTheme } from '@/theme/ThemeContext'; | ||
import { MainThemeProvider } from '@/theme/ThemeContext'; | ||
import { addressKey } from '@/utils/keychainConstants'; | ||
import { SharedValuesProvider } from '@/helpers/SharedValuesContext'; | ||
import { InitialRouteContext } from '@/navigation/initialRoute'; | ||
|
@@ -42,7 +42,7 @@ import { Address } from 'viem'; | |
import { IS_ANDROID, IS_DEV } from '@/env'; | ||
import { prefetchDefaultFavorites } from '@/resources/favorites'; | ||
import Routes from '@/navigation/Routes'; | ||
import { BackendNetworks } from '@/components/BackendNetworks'; | ||
import { BackupsSync } from '@/state/sync/BackupsSync'; | ||
|
||
if (IS_DEV) { | ||
reactNativeDisableYellowBox && LogBox.ignoreAllLogs(); | ||
|
@@ -70,27 +70,39 @@ function App({ walletReady }: AppProps) { | |
}, []); | ||
|
||
return ( | ||
<Portal> | ||
<> | ||
<View style={[sx.container, { paddingBottom: IS_ANDROID ? bottom : 0 }]}> | ||
{initialRoute && ( | ||
<InitialRouteContext.Provider value={initialRoute}> | ||
<Routes ref={handleNavigatorRef} /> | ||
<PortalConsumer /> | ||
</InitialRouteContext.Provider> | ||
)} | ||
<OfflineToast /> | ||
<Toaster /> | ||
</View> | ||
<NotificationsHandler walletReady={walletReady} /> | ||
<DeeplinkHandler initialRoute={initialRoute} walletReady={walletReady} /> | ||
<BackendNetworks /> | ||
</Portal> | ||
<Portal /> | ||
<PortalConsumer /> | ||
<BackupsSync /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In charge of initial backup store sync on mount |
||
</> | ||
); | ||
} | ||
|
||
const AppWithRedux = connect<AppProps, AppDispatch, AppProps, AppState>(state => ({ | ||
walletReady: state.appState.walletReady, | ||
}))(App); | ||
const AppWithRedux = connect<AppProps, AppDispatch, AppProps, AppState>( | ||
state => ({ | ||
walletReady: state.appState.walletReady, | ||
}), | ||
null, | ||
null, | ||
{ | ||
areStatesEqual: (next, prev) => { | ||
// Only update if walletReady actually changed | ||
return next.appState.walletReady === prev.appState.walletReady; | ||
}, | ||
areOwnPropsEqual: shallowEqual, | ||
} | ||
)(memo(App)); | ||
Comment on lines
+92
to
+105
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we only really want to re-render the App when walletReady has changed.. this fixes that |
||
|
||
function Root() { | ||
const [initializing, setInitializing] = useState(true); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are now no longer re-rendering the entire app when re-rendering