Skip to content

Commit

Permalink
Merge pull request #715 from NeurodataWithoutBorders/ensure-workflow-…
Browse files Browse the repository at this point in the history
…persistence

Ensure persistent workflow changes appear in section states
  • Loading branch information
CodyCBakerPhD authored Apr 3, 2024
2 parents 11d16e1 + b873f80 commit 9e71e9d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions environments/environment-Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ dependencies:
- pytest == 7.2.2
- pytest-cov == 4.1.0
- scikit-learn == 1.4.0
- scipy == 1.12.0
6 changes: 3 additions & 3 deletions src/renderer/src/stories/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ export class Dashboard extends LitElement {
else if (typeof page === "object") return this.getPage(Object.values(page)[0]);
}

updateSections({ sidebar = true, main = false } = {}) {
updateSections({ sidebar = true, main = false } = {}, globalState = this.page.info.globalState) {
const info = this.page.info;
let parent = info.parent;

if (sidebar) {
this.subSidebar.sections = this.#getSections(parent.info.pages, info.globalState); // Update sidebar items (if changed)
this.subSidebar.sections = this.#getSections(parent.info.pages, globalState); // Update sidebar items (if changed)
}

const { sections } = this.subSidebar;
Expand Down Expand Up @@ -229,7 +229,7 @@ export class Dashboard extends LitElement {
if (isNested) {
let parent = info.parent;
while (parent.info.parent) parent = parent.info.parent; // Lock sections to the top-level parent
this.updateSections({ sidebar: true });
this.updateSections({ sidebar: true }, toPass.globalState);
this.subSidebar.active = info.id; // Update active item (if changed)
this.sidebar.hide(true);
this.subSidebar.show();
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/stories/pages/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class Page extends LitElement {

updateSections = () => {
const dashboard = document.querySelector("nwb-dashboard");
dashboard.updateSections({ sidebar: true, main: true });
dashboard.updateSections({ sidebar: true, main: true }, this.info.globalState);
};

#unsaved = false;
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/src/stories/pages/guided-mode/setup/Preform.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ export class GuidedPreform extends Page {
if (typeof value === "boolean") {
this.unsavedUpdates = true;
this.info.globalState.project.workflow = this.state;
await this.save({}, false);
this.updateSections();
this.updateSections(); // Trigger section changes with new workflow
await this.save({}, false); // Save new workflow and section changes
}
},
onThrow,
Expand Down

0 comments on commit 9e71e9d

Please sign in to comment.