Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Use normalizeProject when applying presets

Richie McIlroy2f53c14e6e64
diff --git a/apps/desktop/src/routes/editor/PresetsDropdown.tsx b/apps/desktop/src/routes/editor/PresetsDropdown.tsx
index 627493bb7..c50b34ab3 100644
--- a/apps/desktop/src/routes/editor/PresetsDropdown.tsx
+++ b/apps/desktop/src/routes/editor/PresetsDropdown.tsx
@@ -2,7 +2,7 @@ import { DropdownMenu as KDropdownMenu } from "@kobalte/core/dropdown-menu";
import { cx } from "cva";
import { createSignal, For, Show, Suspense } from "solid-js";
import { reconcile } from "solid-js/store";
-import { useEditorContext } from "./context";
+import { normalizeProject, useEditorContext } from "./context";
import {
DropdownItem,
dropdownContainerClasses,
@@ -47,12 +47,11 @@ export function PresetsDropdown() {
function applyPreset() {
setShowSettings(false);
- setProject(
- reconcile({
- ...preset.config,
- timeline: project.timeline,
- }),
- );
+ const normalizedConfig = normalizeProject({
+ ...preset.config,
+ timeline: project.timeline,
+ });
+ setProject(reconcile(normalizedConfig));
}
return (
diff --git a/apps/desktop/src/routes/editor/context.ts b/apps/desktop/src/routes/editor/context.ts
index 1298c4ef9..f9e3d1142 100644
--- a/apps/desktop/src/routes/editor/context.ts
+++ b/apps/desktop/src/routes/editor/context.ts
@@ -86,7 +86,7 @@ function withCornerDefaults<
};
}
-function normalizeProject(
+export function normalizeProject(
config: ProjectConfiguration,
): EditorProjectConfiguration {
return {