Add AppState to export json to fix various import bugs (#358)

* export background, app state

* review comments
This commit is contained in:
Brady Madden 2020-01-15 21:08:52 -05:00 committed by GitHub
parent 0e56cd4f56
commit a3aa57d98b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 11 deletions

View file

@ -40,7 +40,7 @@ export const actionChangeExportBackground: Action = {
export const actionSaveScene: Action = {
name: "saveScene",
perform: (elements, appState, value) => {
saveAsJSON(elements, appState.name);
saveAsJSON(elements, appState);
return {};
},
PanelComponent: ({ updateData }) => (
@ -56,8 +56,12 @@ export const actionSaveScene: Action = {
export const actionLoadScene: Action = {
name: "loadScene",
perform: (elements, appState, loadedElements) => {
return { elements: loadedElements };
perform: (
elements,
appState,
{ elements: loadedElements, appState: loadedAppState }
) => {
return { elements: loadedElements, appState: loadedAppState };
},
PanelComponent: ({ updateData }) => (
<ToolIcon
@ -66,8 +70,8 @@ export const actionLoadScene: Action = {
title="Load"
aria-label="Load"
onClick={() => {
loadFromJSON().then(({ elements }) => {
updateData(elements);
loadFromJSON().then(({ elements, appState }) => {
updateData({ elements: elements, appState: appState });
});
}}
/>