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

perf: Prevent rerendering and re-querying metadata of filters in horizontal bar #22389

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

kgabryje
Copy link
Member

@kgabryje kgabryje commented Dec 12, 2022

SUMMARY

Because of how the component structure changes when filters move in/out of "More filters" dropdown, the FilterValue component is getting unmounted and re-mounted, which causes the whole filter to rerender and resend its metadata query.
To prevent that behaviour, this PR uses react-reverse-portal to ensure that FilterValue component's lifecycle is independent of how its wrappers change. It's a similar pattern that we already use in FilterControls component.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

Screen.Recording.2022-12-12.at.15.09.55.mov

After:

Screen.Recording.2022-12-12.at.15.08.08.mov

TESTING INSTRUCTIONS

  1. Enable HORIZONTAL_FILTER_BAR ff
  2. Add some filters and switch filter bar to horizontal mode
  3. Change window size so that some filters go into/out of "More filters" dropdown and observe that there is no spinner indicating that request is being made. Check that there are no new requests in Network tab

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • 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 @codyml for review

@kgabryje kgabryje changed the title perf: Prevent rerendering and re-querying metadata of filters in hori… perf: Prevent rerendering and re-querying metadata of filters in horizontal bar Dec 12, 2022
Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

LGTM

@kgabryje kgabryje merged commit 605cfa0 into apache:master Dec 12, 2022
jinghua-qa pushed a commit to preset-io/superset that referenced this pull request Dec 12, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 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 preset:2022.49 size/M 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants