Skip to content
Snippets Groups Projects
Commit d9d30b59 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fixes for adding new frames

parent 78c3d331
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ export const pageTitle = atom({
export const streamList = atom({
key: 'streamList',
default: [],
dangerouslyAllowMutability: true,
});
export const nodeList = atom({
......
......@@ -18,7 +18,7 @@ export function StreamDialog({show, onClose, collections}: Props) {
<Dialog show={show}>
<Formik
initialValues={{
collection: '',
collection: collections[0]?.id || '',
title: '',
frameset: 0,
frame: 0,
......@@ -32,9 +32,9 @@ export function StreamDialog({show, onClose, collections}: Props) {
console.error('Bad collection', values.collection);
return;
}
const framesets = [...collection.framesets];
let framesets = [...collection.framesets];
console.log('CREATE STREAM', values, collection);
const frameset = framesets.find(f => f.framesetId === values.frameset);
let frameset = framesets.find(f => f.framesetId === values.frameset);
if (!frameset) {
framesets.push({
framesetId: values.frameset,
......@@ -54,10 +54,10 @@ export function StreamDialog({show, onClose, collections}: Props) {
onClose();
return;
} else {
frameset.frames.push({
frameset.frames = [...frameset.frames, {
title: values.title,
frameId: values.frame,
});
}];
}
}
await saveStream(values.collection, { framesets });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment