Skip to content

Commit 8bb49ef

Browse files
committed
fix: use stable stringify for dirty check, fix Prisma type error
1 parent 5fb7d77 commit 8bb49ef

4 files changed

Lines changed: 25 additions & 13 deletions

File tree

apps/webapp/app/components/admin/FeatureFlagsDialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useFetcher } from "@remix-run/react";
22
import { useEffect, useState } from "react";
3+
import stableStringify from "json-stable-stringify";
34
import {
45
Dialog,
56
DialogContent,
@@ -70,7 +71,7 @@ export function FeatureFlagsDialog({
7071
}
7172
}, [saveFetcher.data]);
7273

73-
const isDirty = JSON.stringify(overrides) !== JSON.stringify(initialOverrides);
74+
const isDirty = stableStringify(overrides) !== stableStringify(initialOverrides);
7475

7576
const setFlagValue = (key: string, value: unknown) => {
7677
setOverrides((prev) => ({ ...prev, [key]: value }));

apps/webapp/app/routes/admin.api.orgs.$orgId.feature-flags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
8585
try {
8686
await prisma.organization.update({
8787
where: { id: orgId },
88-
data: { featureFlags },
88+
data: { featureFlags: featureFlags as Prisma.InputJsonValue },
8989
});
9090
} catch (e) {
9191
if (e instanceof Prisma.PrismaClientKnownRequestError && e.code === "P2025") {

apps/webapp/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
"ioredis": "^5.3.2",
162162
"isbot": "^3.6.5",
163163
"jose": "^5.4.0",
164+
"json-stable-stringify": "^1.3.0",
164165
"jsonpointer": "^5.0.1",
165166
"lodash.omit": "^4.5.0",
166167
"lucide-react": "^0.229.0",

pnpm-lock.yaml

Lines changed: 21 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)