mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 08:13:50 +00:00
A folder or filter fetch started for one account and answered after a switch wrote its result into the stores the next account had just filled. The sidebar then showed the old account's folders, and the filter store kept the old account's rules and script id, so the next save uploaded them - a redirect to someone else's address included - to the new account's server. Clearing the stores for another account now bumps a store epoch. `fetchMailboxes` and the email list's view check drop results from an older epoch, and the filter store drops any fetch that is no longer the latest one.
17 lines
517 B
TypeScript
17 lines
517 B
TypeScript
/**
|
|
* Bumped whenever the account-scoped stores are emptied for another account
|
|
* (an account switch, a sign-out). A fetch captures it before awaiting the
|
|
* server and drops its result if it has changed since: the data belongs to
|
|
* an account that is no longer on screen, and writing it would show - and
|
|
* let the user act on - one account's folders or filters in another.
|
|
*/
|
|
let epoch = 0;
|
|
|
|
export function currentStoreEpoch(): number {
|
|
return epoch;
|
|
}
|
|
|
|
export function bumpStoreEpoch(): void {
|
|
epoch++;
|
|
}
|