diff --git a/frontend/app/utils/shallowCompare.ts b/frontend/app/utils/shallowCompare.ts new file mode 100644 index 00000000..7c17ec05 --- /dev/null +++ b/frontend/app/utils/shallowCompare.ts @@ -0,0 +1,10 @@ +export function shallowCompare(a: T, b: T): boolean { + const entriesA = Object.entries(a); + const keysB = Object.keys(b); + if (entriesA.length !== keysB.length) return false; + for (const [key, value] of entriesA) { + // @ts-ignore + if (value !== b[key]) return false; + } + return true; +}