fix: restored save on change, simplified tool_mode attribution to make it work between updates (#5599)

* Fixed flowStore to run autoSave on setNode

* Fix isToolMode from GenericNode to take already set value from node

* Removed tool_mode from the usePostTemplateValue params, inserting it into inly the payload

* Removing tool_mode from usePostTemplateValue use

* Made toolMode be passed in mutateTemplate

* Refactored activateToolMode to make it work between updates

* Added autoSaveFlow dependency into useEffect

* ✨ (general-bugs-save-changes-on-node.spec.ts): add test to verify that any changes made on the node are saved on user interaction

---------

Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
This commit is contained in:
Lucas Oliveira 2025-01-09 10:58:57 -03:00 • committed by GitHub
commit 0c2de6691d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 86 additions and 44 deletions

View file

@ -0,0 +1,57 @@
import { expect, Page, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
async function verifyTextareaValue(page: Page, value: string) {
await page.getByTestId("textarea_str_input_value").fill(value);
await page.getByTestId("icon-ChevronLeft").first().click();
await page.waitForSelector('[data-testid="list-card"]', {
timeout: 3000,
});
await page.getByTestId("list-card").first().click();
await page.waitForSelector('[data-testid="textarea_str_input_value"]', {
timeout: 3000,
});
const inputValue = await page
.getByTestId("textarea_str_input_value")
.inputValue();
expect(inputValue).toBe(value);
}
test(
"any changes on the node must be saved on user interaction",
{ tag: ["@release", "@components"] },
async ({ page }) => {
const randomValues = Array.from({ length: 4 }, () =>
Math.random().toString(36).substring(2, 15),
);
await awaitBootstrapTest(page);
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="fit_view"]', {
timeout: 100000,
});
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text output");
await page
.getByTestId("outputsText Output")
.hover()
.then(async () => {
await page.getByTestId("add-component-button-text-output").click();
});
await page.waitForSelector('[data-testid="title-Text Output"]', {
timeout: 3000,
});
// Verify each random value
for (const value of randomValues) {
await verifyTextareaValue(page, value);
}
},
);