From aed95a765d2e0adc7cc02de7aaaa176cc9e8392e Mon Sep 17 00:00:00 2001 From: zyoshoka <107108195+zyoshoka@users.noreply.github.com> Date: Wed, 19 Mar 2025 19:52:05 +0900 Subject: [PATCH 1/2] chore(storybook): fix storybook build (#15678) --- .github/workflows/storybook.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml index 9fdbeab913..6608761c13 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -50,8 +50,8 @@ jobs: - run: pnpm i --frozen-lockfile - name: Check pnpm-lock.yaml run: git diff --exit-code pnpm-lock.yaml - - name: Build misskey-js - run: pnpm --filter misskey-js build + - name: Build dependent packages + run: pnpm -F misskey-js -F misskey-bubble-game -F misskey-reversi build - name: Build storybook run: pnpm --filter frontend build-storybook - name: Publish to Chromatic From 4ab9f663569b5e5bf1ad4367aebd4074e4b35e94 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Wed, 19 Mar 2025 20:32:15 +0900 Subject: [PATCH 2/2] Update deep-equal.ts --- packages/frontend/src/utility/deep-equal.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/utility/deep-equal.ts b/packages/frontend/src/utility/deep-equal.ts index c64d82c6cc..2859641dc7 100644 --- a/packages/frontend/src/utility/deep-equal.ts +++ b/packages/frontend/src/utility/deep-equal.ts @@ -3,24 +3,35 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -export function deepEqual(a: any, b: any): boolean { +type JsonLike = string | number | boolean | null | undefined | JsonLike[] | { [key: string]: JsonLike } | Map; + +export function deepEqual(a: JsonLike, b: JsonLike): boolean { if (a === b) return true; + if (typeof a !== typeof b) return false; if (a === null) return b === null; + if (a === undefined) return b === undefined; + if (Array.isArray(a) && Array.isArray(b)) { if (a.length !== b.length) return false; for (let i = 0; i < a.length; i++) { if (!deepEqual(a[i], b[i])) return false; } return true; + } else if (a instanceof Map && b instanceof Map) { + if (a.size !== b.size) return false; + for (const [k, v] of a) { + if (!deepEqual(v, b.get(k))) return false; + } + return true; } else if (((typeof a) === 'object') && ((typeof b) === 'object')) { const aks = Object.keys(a); - const bks = Object.keys(b); + const bks = Object.keys(b as { [key: string]: JsonLike }); if (aks.length !== bks.length) return false; for (let i = 0; i < aks.length; i++) { const k = aks[i]; - if (!deepEqual(a[k], b[k])) return false; + if (!deepEqual(a[k], (b as { [key: string]: JsonLike })[k])) return false; } return true; }