diff --git a/app/shared/db/tree.server.ts b/app/shared/db/tree.server.ts index 22aa2b523a..7e33fda3f9 100644 --- a/app/shared/db/tree.server.ts +++ b/app/shared/db/tree.server.ts @@ -7,11 +7,11 @@ import { import { applyPatches, type Patch } from "immer"; import { prisma } from "./prisma.server"; import { createInstance } from "~/shared/tree-utils"; +import { sort } from "~/shared/breakpoints"; export const createRootInstance = (breakpoints: Array) => { - const defaultBreakpoint = breakpoints.find( - (breakpoint) => breakpoint.minWidth === 0 - ); + // Take the smallest breakpoint as default + const defaultBreakpoint = sort(breakpoints)[0]; if (defaultBreakpoint === undefined) { throw new Error("A breakpoint with minWidth 0 is required"); }