fix(accounts): stabilize extreme toggle bursts

This commit is contained in:
Sucukdeluxe
2026-08-25 06:05:05 +02:00
parent ffc0f918ac
commit 77236f2f08
4 changed files with 59 additions and 34 deletions
+7
View File
@@ -13,6 +13,7 @@ import {
matchesAccountModeFilter,
mergeAccountToggleSettings,
pruneAccountRowSelection,
resolveAccountToggleIntentEnabled,
resolveAccountUsername,
resolveVisibleAccountKind,
sortAccountServices
@@ -143,6 +144,12 @@ describe("account usernames", () => {
});
describe("account toggle bursts", () => {
it("toggles from the synchronous pending intent when the controlled DOM value lags", () => {
expect(resolveAccountToggleIntentEnabled(undefined, false)).toBe(false);
expect(resolveAccountToggleIntentEnabled(false, false)).toBe(true);
expect(resolveAccountToggleIntentEnabled(true, true)).toBe(false);
});
it("serializes different account intents without dropping the second task", async () => {
const queue = createAccountToggleQueue();
const events: string[] = [];
+10
View File
@@ -1356,6 +1356,16 @@ describe("account workspace", () => {
});
describe("settings App integration", () => {
it("serializes local and online backup imports with pending account mutations", () => {
const localImport = sourceBlock(appSource, "const onImportBackup", "const onCreateOnlineBackup");
const onlineImport = sourceBlock(appSource, "const onImportOnlineBackup", "const onCopyOnlineBackupKey");
expect(localImport).toContain("runQueuedSettingsMutation");
expect(onlineImport).toContain("runQueuedSettingsMutation");
expect(localImport.indexOf("runQueuedSettingsMutation")).toBeLessThan(localImport.indexOf("runLocalBackupImport"));
expect(onlineImport.indexOf("runQueuedSettingsMutation")).toBeLessThan(onlineImport.indexOf("window.rd.importOnlineBackup"));
});
it("projects provider order entries with logos and explicit login modes", () => {
const settings = createRendererSettings({
...defaultSettings(),