From 6beb37279bf2466b814c8bd0e5875baaac2c1387 Mon Sep 17 00:00:00 2001 From: Eric Harris-Braun Date: Thu, 18 Jan 2024 18:01:15 -0500 Subject: [PATCH] fix importing compatibility bug --- ui/src/AboutDialog.svelte | 2 +- ui/src/export.ts | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ui/src/AboutDialog.svelte b/ui/src/AboutDialog.svelte index acc42eb..e3931cf 100644 --- a/ui/src/AboutDialog.svelte +++ b/ui/src/AboutDialog.svelte @@ -72,7 +72,7 @@ - +

KanDo! is a demonstration Holochain app built by the Holochain Foundation.

Developers: diff --git a/ui/src/export.ts b/ui/src/export.ts index dd4e185..662e6a7 100644 --- a/ui/src/export.ts +++ b/ui/src/export.ts @@ -1,6 +1,11 @@ import type { BoardState } from "./board" import sanitize from "sanitize-filename"; +interface BoardsExport { + version: string, + boards: Array +} + const EXPORT_FORMAT_VERSION = "1" const PREFIX = "kando" const download = (filename: string, text: string) => { @@ -33,7 +38,7 @@ export const exportBoards = (boards: Array) => { } const _exportBoards = (fileName:string, boards: Array) => { - const exportObject = { + const exportObject: BoardsExport = { version: EXPORT_FORMAT_VERSION, boards, } @@ -42,7 +47,7 @@ const _exportBoards = (fileName:string, boards: Array) => { export const deserializeExport = (jsonExport:string) : Array => { try { - const exportObject = JSON.parse(jsonExport) + const exportObject: BoardsExport = JSON.parse(jsonExport) as BoardsExport if (!exportObject.version) { throw("Expected export to have a version number") } @@ -52,6 +57,12 @@ export const deserializeExport = (jsonExport:string) : Array => { if (!board.props.attachments) { board.props.attachments = [] } + for (const card of board.cards) { + if (!card.props.attachments) { + card.props.attachments = [] + } + } + } return exportObject.boards