Skip to content

Commit

Permalink
Fixed memory leaks in Creator (#6047)
Browse files Browse the repository at this point in the history
* Work for #6029 - Performance: On switching from Preview to Designer adorners are created for all questions - fixed memory leaks (React)

* Fixed lint

* Fixed unit tests

* Fixed unit test

* Fixed question adorner memory leak adorner <-> action circular reference

* Fixed u-test

* Added memory leak test for tabs switching

* Fixed unit and f-tests

* Update performance.ts

* Fixed large json question duplicated names

* Fixed errors in knockout

* Fixed f-tests and updated etalons

* Removed test.only

* Fixed VueJS build

* Updated etalons

* Got rid of ref to toolbox root DOM element

* Added mask

* Fixed f-test

---------

Co-authored-by: tsv2013 <[email protected]>
  • Loading branch information
tsv2013 and tsv2013 authored Nov 15, 2024
1 parent 7537a5c commit ce73974
Show file tree
Hide file tree
Showing 25 changed files with 30,653 additions and 62 deletions.
31 changes: 31 additions & 0 deletions functionalTests/designer/performance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { url, getPagesLength, getQuestionsLength, setJSON, getJSON, getQuestionNameByIndex, getItemValueByIndex, patchDragDropToDisableDrop, RatingToolboxItem, SingleInputToolboxItem, surveySettingsButtonSelector, changeToolboxScrolling, changeToolboxSearchEnabled } from "../helper";
import { Selector, ClientFunction } from "testcafe";
import { large_json } from "./performance_json";
const title = "Performance";

const explicitErrorHandler = () => {
window.addEventListener("error", e => {
if (e.message === "ResizeObserver loop completed with undelivered notifications." ||
e.message === "ResizeObserver loop limit exceeded") {
e.stopImmediatePropagation();
}
});
};

fixture`${title}`.page`${url}`.clientScripts({ content: `(${explicitErrorHandler.toString()})()` }).beforeEach(async (t) => {
await setJSON(large_json);
await t.maximizeWindow();
});

test("Memory leaks between designer/test tabs switch", async (t) => {
const changeTab = ClientFunction((tabName: string) => { window["creator"].activeTab = tabName; });
const getMemory = ClientFunction(() => { return (performance as any).memory.usedJSHeapSize; });

await changeTab("test");
const memory1 = await getMemory();
await changeTab("designer");
await changeTab("test");
const memory2 = await getMemory();

await t.expect((memory2 - memory1) / 1000).lt(1000);
});
Loading

0 comments on commit ce73974

Please sign in to comment.