fix(storybook): prevent infinite remount of component (#14101)

* fix(storybook): prevent infinite remount of component

* fix: disable flaky `.toMatch()` test
This commit is contained in:
zyoshoka
2024-07-02 10:57:20 +09:00
committed by GitHub
parent a6edd50a5d
commit f1b1e2a7cc
7 changed files with 41 additions and 92 deletions

View File

@@ -7,13 +7,3 @@ export async function tick(): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
await new Promise((globalThis.requestIdleCallback ?? setTimeout) as never);
}
/**
* @see https://github.com/misskey-dev/misskey/issues/11267
*/
export function semaphore(counter = 0, waiting: (() => void)[] = []) {
return {
acquire: () => ++counter > 1 && new Promise<void>(resolve => waiting.push(resolve)),
release: () => --counter && waiting.pop()?.(),
};
}