mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(anon mode): user id could change for pending post, name field could bug out
This commit is contained in:
@@ -10,8 +10,6 @@ interface AnonModeState {
|
||||
getThreadSigner: (postCid: string) => any | undefined;
|
||||
setAddressSigner: (signer: any) => void;
|
||||
getAddressSigner: (address: string) => any | undefined;
|
||||
currentAnonSignerAddress: string | null;
|
||||
setCurrentAnonSignerAddress: (address: string | null) => void;
|
||||
}
|
||||
|
||||
const anonModeStore = localForageLru.createInstance({
|
||||
@@ -42,10 +40,6 @@ const useAnonModeStore = create<AnonModeState>((set, get) => ({
|
||||
},
|
||||
getAddressSigner: (address: string) => get().addressSigners[address],
|
||||
currentAnonSignerAddress: null,
|
||||
setCurrentAnonSignerAddress: (address: string | null) => {
|
||||
set({ currentAnonSignerAddress: address });
|
||||
anonModeStore.setItem('currentAnonSignerAddress', address);
|
||||
},
|
||||
}));
|
||||
|
||||
const initializeAnonModeStore = async () => {
|
||||
@@ -64,13 +58,10 @@ const initializeAnonModeStore = async () => {
|
||||
}
|
||||
});
|
||||
|
||||
const currentAnonSignerAddress = await anonModeStore.getItem('currentAnonSignerAddress');
|
||||
|
||||
useAnonModeStore.setState((state) => ({
|
||||
anonMode, // Set the retrieved anonMode state
|
||||
threadSigners: { ...threadSigners, ...state.threadSigners },
|
||||
addressSigners: { ...addressSigners, ...state.addressSigners },
|
||||
currentAnonSignerAddress: currentAnonSignerAddress || null,
|
||||
}));
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user