tb and randompw#29165
Conversation
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -50,7 +51,7 @@ const DeleteConfirm = () => { | |||
| // dont do this in a preflight test | |||
| return | |||
| } | |||
| if (Kb.Styles.isMobile && hasPassword) { | |||
| if (needsMobilePassphraseCheck) { | |||
| navigateAppend({name: 'checkPassphraseBeforeDeleteAccount', params: {}}) | |||
| } else { | |||
There was a problem hiding this comment.
On mobile, needsMobilePassphraseCheck treats randomPW === undefined the same as "has a password" and routes to checkPassphraseBeforeDeleteAccount. If the account actually has a random passphrase (no password) but the RPC hasn’t returned yet (or failed), this flow blocks deletion behind a password prompt the user can’t satisfy. Consider gating the passphrase-check route only when randomPW === false (known to have a password), and disabling/deactivating the confirm action while randomPW is still undefined (or forcing a reload and waiting) so you don’t guess wrong.
| const reload = React.useCallback(() => { | ||
| const version = requestVersionRef.current + 1 | ||
| requestVersionRef.current = version | ||
|
|
||
| const load = async () => { | ||
| try { | ||
| const passphraseState = await T.RPCGen.userLoadPassphraseStateRpcPromise() | ||
| if (requestVersionRef.current !== version) { | ||
| return | ||
| } | ||
| setRandomPW(isRandomPassphraseState(passphraseState)) | ||
| } catch (error) { | ||
| if (!(error instanceof RPCError)) { | ||
| return | ||
| } | ||
| if (requestVersionRef.current !== version) { | ||
| return | ||
| } | ||
| logger.warn('Error loading hasRandomPW:', error.message) | ||
| } | ||
| } | ||
|
|
||
| ignorePromise(load()) | ||
| }, []) |
There was a problem hiding this comment.
reload() can still call setRandomPW(...) after the component using this hook has unmounted (nothing cancels/guards the in-flight RPC). Elsewhere in the repo, async RPC-driven state updates are typically guarded with a mountedRef (or equivalent) to avoid setting state on an unmounted component (e.g. shared/people/container.tsx uses mountedRef.current checks). Consider adding an unmount guard (or abort/cancel pattern) so setRandomPW only runs while mounted.
c8fdcf8
into
nojima/HOTPOT-next-670-clean-2
No description provided.