Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [Data Explorer] Save search rendering wrong on dashboard when refresh is clicked #5116

Closed
abbyhu2000 opened this issue Sep 26, 2023 · 1 comment · Fixed by #5160
Closed
Assignees
Labels
bug Something isn't working data explorer Issues related to the Data Explorer project de-angular de-angularize work test:functional v2.11.0

Comments

@abbyhu2000
Copy link
Member

Describe the bug

The following functional test fail which cause cigroup2 fail. When we unload the index pattern data, and click refresh button, all the embeddables on dashboard should be refreshed and rendered empty; however, saved search did not get refreshed and still have the unexisting data.

describe('dashboard query bar', () => {
    before(async () => {
      await opensearchArchiver.load('dashboard/current/opensearch_dashboards');
      await opensearchDashboardsServer.uiSettings.replace({
        defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
      });
      await PageObjects.common.navigateToApp('dashboard');
      await PageObjects.dashboard.preserveCrossAppState();
      await PageObjects.dashboard.loadSavedDashboard('dashboard with filter');
    });

    it('causes panels to reload when refresh is clicked', async () => {
      await opensearchArchiver.unload('dashboard/current/data');

      await queryBar.clickQuerySubmitButton();
      await retry.tryForTime(5000, async () => {
        debugger;
        const headers = await PageObjects.discover.getColumnHeaders();
        expect(headers.length).to.be(0);
        await pieChart.expectPieSliceCount(0);
      });
    });
  });
Screen.Recording.2023-09-26.at.1.24.35.AM.mov
@abbyhu2000 abbyhu2000 added bug Something isn't working untriaged data explorer Issues related to the Data Explorer project test:functional de-angular de-angularize work and removed untriaged labels Sep 26, 2023
@abbyhu2000 abbyhu2000 changed the title [BUG] [Data Explorer] Save search object rendering wrong on dashboard when refresh is clicked [BUG] [Data Explorer] Save search rendering wrong on dashboard when refresh is clicked Sep 26, 2023
@ananzh ananzh self-assigned this Sep 26, 2023
@ananzh
Copy link
Member

ananzh commented Sep 29, 2023

When updating an embeddable in dashboard, the underlying dashboard container will call reload() for each embeddable.

public reload() {
    Object.values(this.children).forEach((child) => child.reload());
  }

For new Discover, in search_embeddable, the reload function is designed to update the search properties when called. It does so by invoking the pushContainerStateParamsToProps function. The core of the issue lies in the isFetchRequired boolean within this function.

const isFetchRequired =
  !opensearchFilters.onlyDisabledFiltersChanged(this.input.filters, this.prevFilters) ||
  !isEqual(this.prevQuery, this.input.query) ||
  !isEqual(this.prevTimeRange, this.input.timeRange) ||
  !isEqual(searchProps.sort, this.input.sort || this.savedSearch.sort);

The above code checks several conditions to determine if a new data fetch is required. If any of these conditions evaluates to true, then data is fetched anew. However, when an index pattern currently in use by a dashboard is removed, these conditions may not detect any changes (e.g., in query, sort, time range). This means isFetchRequired remains false, preventing the data from being re-fetched.

ananzh added a commit to ananzh/OpenSearch-Dashboards that referenced this issue Sep 29, 2023
…o embeddable

* all reload to force update embeddable
* add onQuerySubmit to top nav

Issue Resolve
opensearch-project#5116
opensearch-project#5159

Signed-off-by: ananzh <[email protected]>
ananzh added a commit to ananzh/OpenSearch-Dashboards that referenced this issue Sep 29, 2023
…o embeddable

* all reload to force update embeddable
* add onQuerySubmit to top nav

Issue Resolve
opensearch-project#5116
opensearch-project#5159

Signed-off-by: ananzh <[email protected]>
ananzh added a commit to ananzh/OpenSearch-Dashboards that referenced this issue Sep 29, 2023
…o embeddable

* all reload to force update embeddable
* add onQuerySubmit to top nav

Issue Resolve
opensearch-project#5116
opensearch-project#5159

Signed-off-by: ananzh <[email protected]>
ananzh added a commit to ananzh/OpenSearch-Dashboards that referenced this issue Sep 29, 2023
…o embeddable

* all reload to force update embeddable
* add onQuerySubmit to top nav

Issue Resolve
opensearch-project#5116
opensearch-project#5159

Signed-off-by: ananzh <[email protected]>
joshuarrrr pushed a commit that referenced this issue Oct 3, 2023
…o embeddable (#5160)

* all reload to force update embeddable
* add onQuerySubmit to top nav

Issue Resolve
#5116
#5159

Signed-off-by: ananzh <[email protected]>
Co-authored-by: Miki <[email protected]>
Co-authored-by: Ashwin P Chandran <[email protected]>
Leo7Deng pushed a commit to Leo7Deng/OpenSearch-Dashboards that referenced this issue Oct 4, 2023
…o embeddable (opensearch-project#5160)

* all reload to force update embeddable
* add onQuerySubmit to top nav

Issue Resolve
opensearch-project#5116
opensearch-project#5159

Signed-off-by: ananzh <[email protected]>
Co-authored-by: Miki <[email protected]>
Co-authored-by: Ashwin P Chandran <[email protected]>
Signed-off-by: Leo Deng <[email protected]>
ananzh added a commit to ananzh/OpenSearch-Dashboards that referenced this issue Oct 4, 2023
… allow force update to embeddable (opensearch-project#5160)

* all reload to force update embeddable
* add onQuerySubmit to top nav

Backport PR
opensearch-project#5160

Issue Resolve
opensearch-project#5116
opensearch-project#5159

Signed-off-by: ananzh <[email protected]>
Co-authored-by: Miki <[email protected]>
Co-authored-by: Ashwin P Chandran <[email protected]>
AMoo-Miki added a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this issue Oct 4, 2023
…o embeddable (opensearch-project#5160)

* all reload to force update embeddable
* add onQuerySubmit to top nav

Issue Resolve
opensearch-project#5116
opensearch-project#5159

Signed-off-by: ananzh <[email protected]>
Co-authored-by: Miki <[email protected]>
Co-authored-by: Ashwin P Chandran <[email protected]>

(cherry picked from commit 7d89cca)
Signed-off-by: Miki <[email protected]>
AMoo-Miki added a commit that referenced this issue Oct 4, 2023
* [BUG][Discover] Add onQuerySubmit to top nav and allow force update to embeddable (#5160)

* all reload to force update embeddable
* add onQuerySubmit to top nav

Issue Resolve
#5116
#5159

Signed-off-by: ananzh <[email protected]>
Co-authored-by: Miki <[email protected]>
Co-authored-by: Ashwin P Chandran <[email protected]>

(cherry picked from commit 7d89cca)
Signed-off-by: Miki <[email protected]>

* [Discover] A bunch of navigation fixes (#5168)

* Discover: Fixes state persistence after nav
* Fixed breadcrumbs and navigation
* fixes mobile view

---------

Signed-off-by: Ashwin P Chandran <[email protected]>

(cherry picked from commit cb6e0f0)
Signed-off-by: Miki <[email protected]>

* [BUG][Data Explorer][Discover] Automatically load solo added default index pattern (#5171)

* [BUG][Data Explorer][Discover] Automatically load solo added default index pattern

This fix ensures that when add a default index pattern, Discover will
automatically select and load its details.

Issue Resolve
#5128

---------

Signed-off-by: ananzh <[email protected]>

(cherry picked from commit 9601c6c)
Signed-off-by: Miki <[email protected]>

* [BUG][Data Explorer][Discover] Allow data grid to auto adjust size based on fetched data count (#5191)

* This PR adds a new rows state to the DiscoverCanvas component and updated it whenever
the data$ observable emitted new row data.
* The DiscoverTable component was then refactored to accept rows as a prop, making it
dependent on the parent component to provide the correct set of data. This ensures that the table
renders correctly based on the current data and doesn't rely on its internal state,
which could be outdated.

Issue Resolve
#5181

Signed-off-by: ananzh <[email protected]>

(cherry picked from commit 677fdf5)
Signed-off-by: Miki <[email protected]>

* Fixes mobile layout (#5195)

Signed-off-by: Ashwin P Chandran <[email protected]>
(cherry picked from commit 0ffd2ab)

* [BUG][Data Explorer][Discover] Allow filter and query persist when refresh page or paste url to a new tab (#5206)

Issue Resolve
#5179
#5071

Signed-off-by: ananzh <[email protected]>

(cherry picked from commit 5623cef)
Signed-off-by: Miki <[email protected]>

* fixes DataTable rendering in doscover (#5207)

Signed-off-by: Ashwin P Chandran <[email protected]>
(cherry picked from commit c70125f)

---------

Signed-off-by: ananzh <[email protected]>
Signed-off-by: Miki <[email protected]>
Signed-off-by: Ashwin P Chandran <[email protected]>
Co-authored-by: Anan Zhuang <[email protected]>
Co-authored-by: Ashwin P Chandran <[email protected]>
willie-hung pushed a commit to willie-hung/OpenSearch-Dashboards that referenced this issue Oct 5, 2023
…o embeddable (opensearch-project#5160)

* all reload to force update embeddable
* add onQuerySubmit to top nav

Issue Resolve
opensearch-project#5116
opensearch-project#5159

Signed-off-by: ananzh <[email protected]>
Co-authored-by: Miki <[email protected]>
Co-authored-by: Ashwin P Chandran <[email protected]>
Signed-off-by: Willie Hung <[email protected]>
SuZhou-Joe pushed a commit to SuZhou-Joe/OpenSearch-Dashboards that referenced this issue Oct 7, 2023
…o embeddable (opensearch-project#5160)

* all reload to force update embeddable
* add onQuerySubmit to top nav

Issue Resolve
opensearch-project#5116
opensearch-project#5159

Signed-off-by: ananzh <[email protected]>
Co-authored-by: Miki <[email protected]>
Co-authored-by: Ashwin P Chandran <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working data explorer Issues related to the Data Explorer project de-angular de-angularize work test:functional v2.11.0
Projects
None yet
3 participants