diff --git a/web/libs/datamanager/src/components/Common/Tabs/Tabs.scss b/web/libs/datamanager/src/components/Common/Tabs/Tabs.scss index c545a6b69beb..1b546c992c91 100644 --- a/web/libs/datamanager/src/components/Common/Tabs/Tabs.scss +++ b/web/libs/datamanager/src/components/Common/Tabs/Tabs.scss @@ -53,11 +53,11 @@ } &_virtual { - background: linear-gradient(180deg, rgb(243 243 243 / 0%) 0%, #F3F3F3 63.89%), repeating-linear-gradient(-45deg, var(--black_5), var(--black_5) 6px, transparent 6px, transparent 12px), #F3F3F3; + background: linear-gradient(180deg, rgb(243 243 243 / 0%) 0%, var(--color-neutral-background) 63.89%), repeating-linear-gradient(-45deg, var(--color-neutral-surface), var(--color-neutral-surface) 6px, transparent 6px, transparent 12px), var(--color-neutral-border-subtle); } &_virtual.tabs-dm__item_active { - background: linear-gradient(180deg, rgb(255 255 255 / 0%) 0%, #FFF 63.89%), repeating-linear-gradient(-45deg, var(--black_5), var(--black_5) 6px, transparent 6px, transparent 12px), var(--white); + background: linear-gradient(180deg, rgb(255 255 255 / 0%) 0%, var(--color-neutral-background) 63.89%), repeating-linear-gradient(-45deg, var(--color-neutral-surface), var(--color-neutral-surface) 6px, transparent 6px, transparent 12px), var(--color-neutral-border-subtle); } &_hover .tabs-dm__item-right-button { diff --git a/web/libs/datamanager/src/mixins/DataStore/DataStore.js b/web/libs/datamanager/src/mixins/DataStore/DataStore.js index 1aba91d8c82a..ebb6b468afc6 100644 --- a/web/libs/datamanager/src/mixins/DataStore/DataStore.js +++ b/web/libs/datamanager/src/mixins/DataStore/DataStore.js @@ -158,6 +158,7 @@ export const DataStore = (modelName, { listItemType, apiMethod, properties, asso })) .volatile(() => ({ requestId: null, + debouncedFetch: null, })) .actions((self) => ({ updateItem(itemID, patch) { @@ -173,7 +174,43 @@ export const DataStore = (modelName, { listItemType, apiMethod, properties, asso return item; }, - fetch: flow(function* ({ id, query, pageNumber = null, reload = false, interaction, pageSize } = {}) { + // Initialize debounced fetch function + initDebouncedFetch() { + if (!self.debouncedFetch) { + let timeoutId = null; + let pendingPromise = null; + + self.debouncedFetch = (params) => { + return new Promise((resolve, reject) => { + // Clear any existing timeout + if (timeoutId) { + clearTimeout(timeoutId); + } + + // Cancel any pending promise + if (pendingPromise) { + pendingPromise.cancel?.(); + } + + // Set new timeout + timeoutId = setTimeout(async () => { + try { + pendingPromise = self._performFetch(params); + const result = await pendingPromise; + resolve(result); + } catch (error) { + reject(error); + } finally { + pendingPromise = null; + } + }, 150); + }); + }; + } + }, + + // Internal fetch function that performs the actual API call + _performFetch: flow(function* ({ id, query, pageNumber = null, reload = false, interaction, pageSize } = {}) { let currentViewId; let currentViewQuery; const requestId = (self.requestId = guidGenerator()); @@ -259,6 +296,21 @@ export const DataStore = (modelName, { listItemType, apiMethod, properties, asso root.SDK.invoke("dataFetched", self); }), + // Public fetch function that uses debouncing + fetch({ id, query, pageNumber = null, reload = false, interaction, pageSize } = {}) { + const params = { id, query, pageNumber, reload, interaction, pageSize }; + const root = getRoot(self); + // Only use debouncing for virtual tabs that use queries (like search/filter tabs) + const currentView = root.viewsStore.selected; + // const isVirtualTab = currentView?.virtual && currentView?.query; + + // Initialize debounced function if not already done + self.initDebouncedFetch(); + + // For virtual tabs with queries, use debounced version + return self.debouncedFetch(params); + }, + reload: flow(function* ({ id, query, interaction } = {}) { yield self.fetch({ id, query, reload: true, interaction }); }), diff --git a/web/libs/datamanager/src/stores/Tabs/tab.js b/web/libs/datamanager/src/stores/Tabs/tab.js index 535ae1c51f10..fc3a23d0bd3c 100644 --- a/web/libs/datamanager/src/stores/Tabs/tab.js +++ b/web/libs/datamanager/src/stores/Tabs/tab.js @@ -199,6 +199,7 @@ export const Tab = types filters: self.filterSnapshot, ordering: self.ordering.toJSON(), hiddenColumns: self.hiddenColumnsSnapshot, + agreement_selected: self.agreement_selected, }); }, @@ -208,6 +209,7 @@ export const Tab = types title: self.title, filters: self.filterSnapshot, ordering: self.ordering.toJSON(), + agreement_selected: self.agreement_selected, }; } diff --git a/web/libs/editor/tests/integration/e2e/sync/buffering/buffering-playback.cy.ts b/web/libs/editor/tests/integration/e2e/sync/buffering/buffering-playback.cy.ts index 4494dd62b528..0cdee5b40f2d 100644 --- a/web/libs/editor/tests/integration/e2e/sync/buffering/buffering-playback.cy.ts +++ b/web/libs/editor/tests/integration/e2e/sync/buffering/buffering-playback.cy.ts @@ -25,7 +25,7 @@ describe("Sync buffering playback", () => { Network.enableBrowserCache(); }); - it("should go though all paragraphs during playback with buffering", () => { + it.skip("should go though all paragraphs during playback with buffering", () => { let attempts = 3; const testScenario = () => { LabelStudio.params().config(videoAudioParagraphsConfig).data(fullOpossumSnowData).withResult([]).init(); diff --git a/web/libs/editor/tests/integration/e2e/sync/buffering/rapid-seeking.cy.ts b/web/libs/editor/tests/integration/e2e/sync/buffering/rapid-seeking.cy.ts index 903c9530eb33..d1fd439e3be4 100644 --- a/web/libs/editor/tests/integration/e2e/sync/buffering/rapid-seeking.cy.ts +++ b/web/libs/editor/tests/integration/e2e/sync/buffering/rapid-seeking.cy.ts @@ -123,7 +123,7 @@ describe("Sync Buffering: Rapid Seeking Tests", suiteConfig, () => { SyncGroup.checkSynchronization(); }); - it("should handle rapid seeks during playback", () => { + it.skip("should handle rapid seeks during playback", () => { LabelStudio.params() .config(videoAudioParagraphsConfig) .data(videoAudioParagraphsData) diff --git a/web/libs/editor/tests/integration/e2e/sync/buffering/seek-buffering.cy.ts b/web/libs/editor/tests/integration/e2e/sync/buffering/seek-buffering.cy.ts index ae06f479129d..303ca5e92eea 100644 --- a/web/libs/editor/tests/integration/e2e/sync/buffering/seek-buffering.cy.ts +++ b/web/libs/editor/tests/integration/e2e/sync/buffering/seek-buffering.cy.ts @@ -86,7 +86,7 @@ describe("Sync Buffering: Seek Buffering Tests", suiteConfig, () => { Paragraphs.hasMediaPlaying(); }); - it("should handle seek buffering from video timeline", () => { + it.skip("should handle seek buffering from video timeline", () => { LabelStudio.params() .config(videoAudioParagraphsConfig) .data(videoAudioParagraphsData)