Oops, fix a bug where incorrect login closed modal
Oh yeah, ok, we don't actually want to evict `currentUser` from the Apollo cache on *any* login mutation. That's both inefficient, and puts our navbar in a loading state that hides the login button and thereby unmounts the login modal, oops!
This commit is contained in:
parent
92ade4a513
commit
39852c8297
1 changed files with 3 additions and 3 deletions
|
@ -78,11 +78,11 @@ function LoginForm({ onSuccess }) {
|
|||
// I don't do any optimistic UI here, because auth is complex enough
|
||||
// that I'd rather only show login success after validating it through
|
||||
// an actual server round-trip.
|
||||
cache.evict({ id: "ROOT_QUERY", fieldName: "currentUser" });
|
||||
if (data.login?.id != null) {
|
||||
cache.evict({ id: "ROOT_QUERY", fieldName: "currentUser" });
|
||||
cache.evict({ id: `User:${data.login.id}` });
|
||||
cache.gc();
|
||||
}
|
||||
cache.gc();
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -99,7 +99,7 @@ function LoginForm({ onSuccess }) {
|
|||
onSuccess();
|
||||
}
|
||||
})
|
||||
.catch((e) => {}); // handled in error UI
|
||||
.catch((e) => console.error(e)); // plus the error UI
|
||||
}}
|
||||
>
|
||||
<FormControl>
|
||||
|
|
Loading…
Reference in a new issue