Skip to content

Commit

Permalink
Merge branch 'main' into auth/pm-8221/route-user-to-email-otp-entry-c…
Browse files Browse the repository at this point in the history
…lients
  • Loading branch information
alec-livefront committed Jan 22, 2025
2 parents ccac0de + 649a196 commit 9fd82e1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jest.mock("../utils", () => {
const utils = jest.requireActual("../utils");
return {
...utils,
debounce: jest.fn((fn, wait) => setTimeout(() => fn(), wait)),
debounce: jest.fn((fn) => fn),
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,7 @@ export class CollectAutofillContentService implements CollectAutofillContentServ
}

if (!this.mutationsQueue.length) {
// Collect all mutations and debounce the processing of those mutations by 100ms to ensure we don't process too many mutations at once.
debounce(this.processMutations, 100);
requestIdleCallbackPolyfill(debounce(this.processMutations, 100), { timeout: 500 });
}
this.mutationsQueue.push(mutations);
};
Expand Down
4 changes: 3 additions & 1 deletion apps/browser/src/autofill/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export function requestIdleCallbackPolyfill(
return globalThis.requestIdleCallback(() => callback(), options);
}

return globalThis.setTimeout(() => callback(), 1);
const timeoutDelay = options?.timeout || 1;

return globalThis.setTimeout(() => callback(), timeoutDelay);
}

/**
Expand Down
16 changes: 8 additions & 8 deletions apps/cli/src/tools/import.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
// @ts-strict-ignore
import { OptionValues } from "commander";
import * as inquirer from "inquirer";
import { firstValueFrom, map } from "rxjs";
import { firstValueFrom } from "rxjs";

import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import {
OrganizationService,
getOrganizationById,
} from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { getUserId } from "@bitwarden/common/auth/services/account.service";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { ImportServiceAbstraction, ImportType } from "@bitwarden/importer/core";

Expand All @@ -24,16 +28,12 @@ export class ImportCommand {
async run(format: ImportType, filepath: string, options: OptionValues): Promise<Response> {
const organizationId = options.organizationid;
if (organizationId != null) {
const userId = await firstValueFrom(
this.accountService.activeAccount$.pipe(map((a) => a?.id)),
);
const userId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
if (!userId) {
return Response.badRequest("No user found.");
}
const organization = await firstValueFrom(
this.organizationService
.organizations$(userId)
.pipe(map((organizations) => organizations.find((o) => o.id === organizationId))),
this.organizationService.organizations$(userId).pipe(getOrganizationById(organizationId)),
);

if (organization == null) {
Expand Down

0 comments on commit 9fd82e1

Please sign in to comment.