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

fix(dashboard): Prevent rerendering View Query modal on window resize #15172

Merged
merged 2 commits into from Jun 15, 2021

Conversation

kgabryje
Copy link
Member

SUMMARY

Due to using a complex javascript object in useEffect's dependency array in ViewQueryModal, we were rerunning API request on every rerender of the modal (including resizing window). I fixed it by using JSON.stringify method in the dependency array.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: see #14696
After:
https://user-images.githubusercontent.com/15073128/122034659-070c3980-cdd2-11eb-8617-6650cf4b3c43.mov

TESTING INSTRUCTIONS

  1. Open a dashboard and View Query modal
  2. Resize window
  3. Verify that API request wasn't rerun after resizing window.

ADDITIONAL INFORMATION

  • Has associated issue: closes [x-filtering]resizing window should not trigger query on dashboard #14696
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

CC: @junlincc

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just ran into this today, thanks for fixing! LGTM once passes lint (I assume useCallback isn't needed here).

@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import React, { useEffect, useState } from 'react';
import React, { useEffect, useState, useCallback } from 'react';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't appear to be needed here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, forgot to remove it. Thanks!

@codecov
Copy link

codecov bot commented Jun 15, 2021

Codecov Report

Merging #15172 (6964e97) into master (b3c1979) will decrease coverage by 0.16%.
The diff coverage is 30.00%.

❗ Current head 6964e97 differs from pull request most recent head 827c3a3. Consider uploading reports for the commit 827c3a3 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15172      +/-   ##
==========================================
- Coverage   77.41%   77.25%   -0.17%     
==========================================
  Files         969      969              
  Lines       49999    50011      +12     
  Branches     6424     6431       +7     
==========================================
- Hits        38705    38634      -71     
- Misses      11091    11174      +83     
  Partials      203      203              
Flag Coverage Δ
hive ?
javascript 72.22% <30.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...mponents/nativeFilters/FiltersConfigModal/utils.ts 66.25% <ø> (ø)
...nd/src/dashboard/components/nativeFilters/utils.ts 56.25% <ø> (ø)
...src/explore/components/controls/ViewQueryModal.tsx 76.92% <ø> (ø)
...onfigModal/FiltersConfigForm/FiltersConfigForm.tsx 68.83% <16.66%> (-1.24%) ⬇️
...ols/DateFilterControl/components/CalendarFrame.tsx 42.85% <25.00%> (-3.30%) ⬇️
...tersConfigModal/FiltersConfigForm/ColumnSelect.tsx 97.36% <100.00%> (+0.22%) ⬆️
superset/db_engines/hive.py 0.00% <0.00%> (-82.15%) ⬇️
superset/db_engine_specs/hive.py 70.32% <0.00%> (-17.08%) ⬇️
superset/views/database/mixins.py 81.03% <0.00%> (-1.73%) ⬇️
superset/db_engine_specs/presto.py 83.36% <0.00%> (-1.06%) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b3c1979...827c3a3. Read the comment docs.

@kgabryje kgabryje merged commit 5316dc8 into apache:master Jun 15, 2021
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
…apache#15172)

* fix(dashboard): Prevent rerendering View Query modal on window resize

* Fix lint
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
…apache#15172)

* fix(dashboard): Prevent rerendering View Query modal on window resize

* Fix lint
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
…apache#15172)

* fix(dashboard): Prevent rerendering View Query modal on window resize

* Fix lint
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XS 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[x-filtering]resizing window should not trigger query on dashboard
3 participants