Skip to content

Commit d80c022

Browse files
committed
fix desktop meta
1 parent 94b5c67 commit d80c022

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

apps/desktop/src/routes/editor/Editor.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ import {
1414
onMount,
1515
} from "solid-js";
1616
import { createStore } from "solid-js/store";
17-
17+
import { mergeProps } from "solid-js";
1818
import { makePersisted } from "@solid-primitives/storage";
19+
1920
import Cropper, { cropToFloor } from "~/components/Cropper";
2021
import Tooltip from "~/components/Tooltip";
2122
import { events, type Crop } from "~/utils/tauri";
@@ -53,7 +54,14 @@ export function Editor() {
5354

5455
return {
5556
editorInstance,
56-
meta: () => ctx.metaQuery.data,
57+
meta: mergeProps(() => {
58+
const d = ctx.metaQuery.data;
59+
if (!d)
60+
throw new Error(
61+
"metaQuery.data is undefined - how did this happen?"
62+
);
63+
return d;
64+
}),
5765
refetchMeta: async () => {
5866
await ctx.metaQuery.refetch();
5967
},

apps/desktop/src/routes/editor/ExportDialog.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export function ExportDialog() {
199199

200200
const savePath = await saveDialog({
201201
filters: [{ name: "mp4 filter", extensions: ["mp4"] }],
202-
defaultPath: `~/Desktop/${meta()?.prettyName}.mp4`,
202+
defaultPath: `~/Desktop/${meta?.prettyName}.mp4`,
203203
});
204204
if (!savePath) {
205205
setExportState(reconcile({ type: "idle" }));
@@ -300,7 +300,7 @@ export function ExportDialog() {
300300
setExportState({ type: "uploading", progress: 0 });
301301

302302
// Now proceed with upload
303-
const result = meta()?.sharing
303+
const result = meta?.sharing
304304
? await commands.uploadExportedVideo(projectPath, "Reupload")
305305
: await commands.uploadExportedVideo(projectPath, {
306306
Initial: { pre_created_video: null },
@@ -797,7 +797,7 @@ export function ExportDialog() {
797797
>
798798
<div class="relative">
799799
<a
800-
href={meta()?.sharing?.link}
800+
href={meta.sharing?.link}
801801
target="_blank"
802802
rel="noreferrer"
803803
class="block"
@@ -808,7 +808,7 @@ export function ExportDialog() {
808808
setTimeout(() => {
809809
setCopyPressed(false);
810810
}, 2000);
811-
navigator.clipboard.writeText(meta()?.sharing?.link!);
811+
navigator.clipboard.writeText(meta.sharing?.link!);
812812
}}
813813
variant="lightdark"
814814
class="flex gap-2 justify-center items-center"

apps/desktop/src/routes/editor/ShareButton.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function ShareButton() {
8686
setUploadState({ type: "uploading", progress: 0 });
8787

8888
// Now proceed with upload
89-
const result = meta()?.sharing
89+
const result = meta.sharing
9090
? await commands.uploadExportedVideo(projectPath, "Reupload")
9191
: await commands.uploadExportedVideo(projectPath, {
9292
Initial: { pre_created_video: null },
@@ -136,7 +136,7 @@ function ShareButton() {
136136

137137
return (
138138
<div class="relative">
139-
<Show when={meta()?.sharing}>
139+
<Show when={meta.sharing}>
140140
{(sharing) => {
141141
const url = () => new URL(sharing().link);
142142

apps/desktop/src/routes/editor/context.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export type RenderState =
5454

5555
export const [EditorContextProvider, useEditorContext] = createContextProvider(
5656
(props: {
57-
meta: () => TransformedMeta | undefined;
57+
meta: TransformedMeta;
5858
editorInstance: SerializedEditorInstance;
5959
refetchMeta(): Promise<void>;
6060
}) => {
@@ -197,9 +197,7 @@ export const [EditorContextProvider, useEditorContext] = createContextProvider(
197197

198198
return {
199199
...editorInstanceContext,
200-
get meta() {
201-
return props.meta;
202-
},
200+
meta: props.meta,
203201
refetchMeta: () => props.refetchMeta(),
204202
editorInstance: props.editorInstance,
205203
dialog,

0 commit comments

Comments
 (0)