From 54bd12569b9b98fbc6542db2db79652879aef877 Mon Sep 17 00:00:00 2001 From: FMS-Cat Date: Thu, 19 Nov 2020 01:28:12 +0900 Subject: [PATCH] fix (gui, compat): data without version should be treated as latest --- packages/automaton-with-gui/src/compat/compat.ts | 7 ++----- .../automaton-with-gui/src/compat/preversionCompat.ts | 9 --------- 2 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 packages/automaton-with-gui/src/compat/preversionCompat.ts diff --git a/packages/automaton-with-gui/src/compat/compat.ts b/packages/automaton-with-gui/src/compat/compat.ts index 14d359ca..c916fd69 100644 --- a/packages/automaton-with-gui/src/compat/compat.ts +++ b/packages/automaton-with-gui/src/compat/compat.ts @@ -1,6 +1,5 @@ import { SerializedAutomatonWithGUI, defaultDataWithGUI } from '../types/SerializedAutomatonWithGUI'; import { jsonCopy } from '../utils/jsonCopy'; -import { preversionCompat } from './preversionCompat'; import { v1Compat } from './v1Compat'; import { v2Compat } from './v2Compat'; import { v3Compat } from './v3Compat'; @@ -21,10 +20,8 @@ export function compat( data?: any ): SerializedAutomatonWithGUI { let version = parseFloat( newData.version ) || parseFloat( newData.v ); if ( !version && !newData.rev ) { - newData = preversionCompat( newData ); - if ( newData === null ) { - return jsonCopy( defaultDataWithGUI ); - } + // assuming it's latest + return newData; } if ( newData.rev ) { // fuck diff --git a/packages/automaton-with-gui/src/compat/preversionCompat.ts b/packages/automaton-with-gui/src/compat/preversionCompat.ts deleted file mode 100644 index e7128f0c..00000000 --- a/packages/automaton-with-gui/src/compat/preversionCompat.ts +++ /dev/null @@ -1,9 +0,0 @@ -export function preversionCompat( data: any ): any { - if ( data.gui ) { - delete data.gui; // the gui settings are incompatible - return data; - } else { - console.error( 'Loaded data is not compatible with this revision' ); - return null; - } -}