Skip to content
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

Fix zustand race condition #788

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/extension/src/routes/popup/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IndexHeader } from './index-header';
import { useStore } from '../../../state';
import { BlockSync } from './block-sync';
import { localExtStorage } from '@penumbra-zone/storage';
import { addrByIndexSelector } from '../../../state/wallets';
import { addrByIndexSelector, getActiveWallet } from '../../../state/wallets';
import { needsLogin } from '../popup-needs';

export interface PopupLoaderData {
Expand All @@ -17,13 +17,14 @@ export const popupIndexLoader = async (): Promise<Response | PopupLoaderData> =>
(await needsLogin()) ?? { fullSyncHeight: await localExtStorage.get('fullSyncHeight') };

export const PopupIndex = () => {
const activeWallet = useStore(getActiveWallet);
const getAddrByIndex = useStore(addrByIndexSelector);

return (
<div className='flex h-full grow flex-col items-stretch justify-start bg-logo bg-left-bottom px-[30px]'>
<IndexHeader />
<div className='my-32'>
<SelectAccount getAddrByIndex={getAddrByIndex} />
{activeWallet && <SelectAccount getAddrByIndex={getAddrByIndex} />}
</div>
<BlockSync />
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/components/ui/block-sync-status/large.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const FullySyncedState = ({ latestKnownBlockHeight, fullSyncHeight }: SyncingSta
width='50'
color='var(--teal)'
wrapperClass={cn(
'transition-all duration-300 absolute bottom-0 right-3',
'transition-all duration-300 absolute bottom-0 -left-7',
Copy link
Collaborator Author

@grod220 grod220 Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This guy has been annoying me as well. With the fix, as the number grows, it will always be spaced out.

Screenshot 2024-03-18 at 9 16 06 PM

showLoader ? 'opacity-100' : 'opacity-0',
)}
/>
Expand Down
Loading