-
Notifications
You must be signed in to change notification settings - Fork 17
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
Clear cache fix & added sync states #883
Conversation
@@ -11,7 +11,7 @@ declare const MINIFRONT_URL: string; | |||
|
|||
export const localDefaults: LocalStorageState = { | |||
wallets: [], | |||
fullSyncHeight: 0, | |||
fullSyncHeight: undefined, |
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.
This is sort of a bug somewhat relating to: #882.
0 sync height indicates that we've synced the genesis block. So undefined
should be used as the proper default indicating no sync has been done. Lots of changes in components flow from this one change.
await chrome.runtime.sendMessage(ServicesMessage.ClearCache); | ||
useStore.setState(state => { | ||
state.network.fullSyncHeight = undefined; | ||
}); |
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.
Two things happening here:
- Awaiting cache clearing to finish
- resetting zustand sync height
Only after this do we navigate. Sometimes this can be slower, so added a loading state.
<motion.div | ||
className='flex w-full flex-col gap-1' | ||
initial={{ opacity: 0 }} | ||
animate={{ opacity: 1, transition: { duration: 0.3, ease: 'easeOut', delay: 0.75 } }} |
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.
Set a short delay. If not, flickers the screen.
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.
Not sure I understand what flickers, but setting a hard-coded time delay to avoid flicker feels a little hacky to me, since whether it works depends on the speed of the user's computer. Is there not a deterministic way to prevent flicker?
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.
Here's without it. Essentially, we need a sort of UI debouncer to prevent it. I found a slight animation delay is sufficient, but perhaps there is a better way 🤔
Screen.Recording.2024-04-05.at.5.53.03.AM.mov
@@ -56,7 +90,7 @@ const SyncingState = ({ fullSyncHeight, latestKnownBlockHeight }: SyncingStatePr | |||
return ( | |||
<motion.div | |||
className='flex w-full flex-col items-center gap-1' | |||
initial={{ opacity: 1 }} | |||
initial={{ opacity: 0 }} |
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.
bug fix
417e642
to
95e8214
Compare
95e8214
to
cfa0e0a
Compare
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.
Couple small Qs, but feel free to merge after addressing those. This is a big UX win!
@@ -12,7 +12,9 @@ export const LargeBlockSyncStatus = ({ | |||
error, | |||
}: BlockSyncProps) => { | |||
if (error) return <BlockSyncErrorState error={error} />; | |||
if (!latestKnownBlockHeight || !fullSyncHeight) return <div />; | |||
if (!latestKnownBlockHeight || !fullSyncHeight) { |
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.
Shouldn't this be checking for !== undefined
? Since 0n
now means that the first block has synced?
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.
Aha! This edge case is the gift that keeps on giving.
<motion.div | ||
className='flex w-full flex-col gap-1' | ||
initial={{ opacity: 0 }} | ||
animate={{ opacity: 1, transition: { duration: 0.3, ease: 'easeOut', delay: 0.75 } }} |
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.
Not sure I understand what flickers, but setting a hard-coded time delay to avoid flicker feels a little hacky to me, since whether it works depends on the speed of the user's computer. Is there not a deterministic way to prevent flicker?
Closes #824
Does two main things:
vid_compressed.mp4