Skip to content

Commit

Permalink
Fix path export changes made in #1081 (#1120)
Browse files Browse the repository at this point in the history
  • Loading branch information
shueja authored Jan 6, 2025
1 parent a9ebccc commit d044d84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
15 changes: 1 addition & 14 deletions src/document/PathListStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@ export const PathListStore = types
activePathUUID: "",
defaultPath: types.maybe(HolonomicPathStore)
})
.actions((self) => {
let pathExporter: (uuid: string) => void = (_uuid) => {};
return {
setExporter(exportFunction: (uuid: string) => void) {
pathExporter = exportFunction;
self.paths.forEach((p) => p.setExporter(pathExporter));
},
getExporter(): (uuid: string) => void {
return pathExporter;
}
};
})
.views((self) => {
return {
toJSON(): any {
Expand Down Expand Up @@ -89,7 +77,7 @@ export const PathListStore = types
},
markers: []
});
path.setExporter((uuid) => {});
path.disableExport();
self.defaultPath = path;
self.activePathUUID = path.uuid;
},
Expand Down Expand Up @@ -128,7 +116,6 @@ export const PathListStore = types
markers: []
});
self.paths.put(path); //It's not ready yet but it needs to get the env injected
path.setExporter(self.getExporter());
if (contents !== undefined) {
path.deserialize(contents);
} else {
Expand Down
7 changes: 4 additions & 3 deletions src/document/path/HolonomicPathStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,16 @@ export const HolonomicPathStore = types
}
);
};
const setExporter = (exportFunction: (uuid: string) => void) => {
exporter = exportFunction;
/**Only to be used on the default path*/
const disableExport = () => {
exporter = () => {};
};
const beforeDestroy = () => {
autosaveDisposer();
};
return {
afterCreate,
setExporter,
disableExport,
beforeDestroy
};
});
Expand Down

0 comments on commit d044d84

Please sign in to comment.