From ab9835b30d37474ab69a501db2d30b607fb8d79d Mon Sep 17 00:00:00 2001 From: Oleg Isonen Date: Wed, 11 May 2022 00:18:03 +0200 Subject: [PATCH] take the smallest breakpoint as default when creating a new project no longer require to have a 0 minWidth breakpoint --- app/shared/db/tree.server.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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"); }