Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3355758
D12233.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12233.diff
View Options
diff --git a/lib/keyserver-conn/recovery-utils.js b/lib/keyserver-conn/recovery-utils.js
--- a/lib/keyserver-conn/recovery-utils.js
+++ b/lib/keyserver-conn/recovery-utils.js
@@ -162,10 +162,10 @@
);
// We only need to do a "spot check" on this value below.
- // - To avoid regenerating performRecovery whenever it changes, we want to
- // make sure it's not in that function's dep list.
- // - If we exclude it from that function's dep list, we'll end up binding in
- // the value of preRequestUserState at the time performRecovery is updated.
+ // - To avoid regenerating below callbacks whenever it changes, we want to
+ // make sure it's not in those callbacks' dep lists.
+ // - If we exclude it from those callbacks' dep lists, we'll end up binding in
+ // the value of preRequestUserState at the time the callbacks are updated.
// Instead, by assigning to a ref, we are able to use the latest value.
const preRequestUserStateRef = React.useRef(preRequestUserState);
preRequestUserStateRef.current = preRequestUserState;
@@ -180,7 +180,6 @@
(
source: RecoveryActionSource,
sessionChange: ClientSessionChange,
- userStateBeforeRecovery: PreRequestUserState,
hasBeenCancelled: () => boolean,
) => {
if (hasBeenCancelled()) {
@@ -189,7 +188,7 @@
setNewSession(
dispatch,
sessionChange,
- userStateBeforeRecovery,
+ preRequestUserStateRef.current,
null,
source,
keyserverID,
@@ -236,12 +235,7 @@
!sessionChange.cookie ||
!sessionChange.cookie.startsWith('user=')
) {
- invalidateKeyserverSession(
- source,
- sessionChange,
- userStateBeforeRecovery,
- hasBeenCancelled,
- );
+ invalidateKeyserverSession(source, sessionChange, hasBeenCancelled);
}
} catch (e) {
if (hasBeenCancelled()) {
@@ -254,7 +248,6 @@
invalidateKeyserverSession(
source,
genericCookieInvalidation,
- userStateBeforeRecovery,
hasBeenCancelled,
);
throw e;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 3:23 PM (22 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2576553
Default Alt Text
D12233.diff (2 KB)
Attached To
Mode
D12233: [lib] Avoid passing userStateBeforeRecovery to invalidateKeyserverSession
Attached
Detach File
Event Timeline
Log In to Comment