You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/10/15 18:19:44 UTC

[GitHub] [superset] stephenLYZ opened a new pull request, #21821: perf(native-filters): improve native filter modal performance

stephenLYZ opened a new pull request, #21821:
URL: https://github.com/apache/superset/pull/21821

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   Improve native filter modal performance by adding memo or reduce rendering.
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   Test case : 30+ native filters, 20+ charts
   ### Re-renderings for native filter form:
   #### before: 538
   #### after: 4
   ### native filter modal opening
   #### before
   ##### timing: 13s
   
   <img width="1253" alt="image" src="https://user-images.githubusercontent.com/11830681/196002050-aa5c8dfb-097d-4aef-a194-8d4dd1299ae0.png">
   
   #### after
   ##### timing:  400ms
   
   <img width="490" alt="image" src="https://user-images.githubusercontent.com/11830681/196001864-c2492d8c-72cc-4538-8beb-7199107fedb1.png">
   
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] zhaoyongjie commented on a diff in pull request #21821: perf(native-filters): improve native filter modal form performance

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on code in PR #21821:
URL: https://github.com/apache/superset/pull/21821#discussion_r1002929562


##########
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx:
##########
@@ -153,19 +153,27 @@ export function FiltersConfigModal({
 
   const unsavedFiltersIds = newFilterIds.filter(id => !removedFilters[id]);
   // brings back a filter that was previously removed ("Undo")
-  const restoreFilter = (id: string) => {
-    const removal = removedFilters[id];
-    // gotta clear the removal timeout to prevent the filter from getting deleted
-    if (removal?.isPending) clearTimeout(removal.timerId);
-    setRemovedFilters(current => ({ ...current, [id]: null }));
-  };
+  const restoreFilter = useCallback(
+    (id: string) => {
+      const removal = removedFilters[id];
+      // gotta clear the removal timeout to prevent the filter from getting deleted
+      if (removal?.isPending) clearTimeout(removal.timerId);
+      setRemovedFilters(current => ({ ...current, [id]: null }));
+    },
+    [removedFilters],
+  );
   const getInitialFilterOrder = () => Object.keys(filterConfigMap);
 
   // State for tracking the re-ordering of filters
   const [orderedFilters, setOrderedFilters] = useState<string[]>(
     getInitialFilterOrder(),
   );
 
+  // State for rendered filter to improve performance
+  const [renderedFilters, setRenderedFilters] = useState<string[]>([

Review Comment:
   nits: use Set for this case.
   
   ```typescript
   const [renderedFilters, setRenderedFilters] = useState<Set[]>([
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] stephenLYZ merged pull request #21821: perf(native-filters): improve native filter modal form performance

Posted by GitBox <gi...@apache.org>.
stephenLYZ merged PR #21821:
URL: https://github.com/apache/superset/pull/21821


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] github-actions[bot] commented on pull request #21821: perf(native-filters): improve native filter modal form performance

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #21821:
URL: https://github.com/apache/superset/pull/21821#issuecomment-1296289925

   Ephemeral environment shutdown and build artifacts deleted.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] github-actions[bot] commented on pull request #21821: perf(native-filters): improve native filter modal form performance

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #21821:
URL: https://github.com/apache/superset/pull/21821#issuecomment-1286404991

   @stephenLYZ Ephemeral environment spinning up at http://34.210.29.66:8080. Credentials are `admin`/`admin`. Please allow several minutes for bootstrapping and startup.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] michael-s-molina commented on pull request #21821: perf(native-filters): improve native filter modal form performance

Posted by GitBox <gi...@apache.org>.
michael-s-molina commented on PR #21821:
URL: https://github.com/apache/superset/pull/21821#issuecomment-1281532338

   @jinghua-qa I tested the module but we'll definitely need your help here. Can you book some time to test this PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #21821: perf(native-filters): improve native filter modal form performance

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #21821:
URL: https://github.com/apache/superset/pull/21821#issuecomment-1279937586

   # [Codecov](https://codecov.io/gh/apache/superset/pull/21821?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#21821](https://codecov.io/gh/apache/superset/pull/21821?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4a8d89e) into [master](https://codecov.io/gh/apache/superset/commit/f58227a9124866d1db0dcb20947e9bee287ba0fc?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f58227a) will **increase** coverage by `0.04%`.
   > The diff coverage is `60.46%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #21821      +/-   ##
   ==========================================
   + Coverage   66.84%   66.89%   +0.04%     
   ==========================================
     Files        1800     1805       +5     
     Lines       68951    69059     +108     
     Branches     7335     7372      +37     
   ==========================================
   + Hits        46092    46197     +105     
   + Misses      20965    20952      -13     
   - Partials     1894     1910      +16     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | javascript | `53.29% <60.46%> (+0.13%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/21821?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...eFilters/FiltersConfigModal/FiltersConfigModal.tsx](https://codecov.io/gh/apache/superset/pull/21821/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvRmlsdGVyc0NvbmZpZ01vZGFsL0ZpbHRlcnNDb25maWdNb2RhbC50c3g=) | `64.43% <54.28%> (+1.38%)` | :arrow_up: |
   | [...ters/FiltersConfigModal/FiltersConfigForm/utils.ts](https://codecov.io/gh/apache/superset/pull/21821/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvRmlsdGVyc0NvbmZpZ01vZGFsL0ZpbHRlcnNDb25maWdGb3JtL3V0aWxzLnRz) | `77.77% <75.00%> (-4.58%)` | :arrow_down: |
   | [...Filters/FiltersConfigModal/FilterConfigurePane.tsx](https://codecov.io/gh/apache/superset/pull/21821/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvRmlsdGVyc0NvbmZpZ01vZGFsL0ZpbHRlckNvbmZpZ3VyZVBhbmUudHN4) | `100.00% <100.00%> (ø)` | |
   | [...onfigModal/FiltersConfigForm/FiltersConfigForm.tsx](https://codecov.io/gh/apache/superset/pull/21821/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvRmlsdGVyc0NvbmZpZ01vZGFsL0ZpbHRlcnNDb25maWdGb3JtL0ZpbHRlcnNDb25maWdGb3JtLnRzeA==) | `59.50% <100.00%> (ø)` | |
   | [...ontrols/DateFilterControl/utils/dateFilterUtils.ts](https://codecov.io/gh/apache/superset/pull/21821/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy9kYXRlRmlsdGVyVXRpbHMudHM=) | `39.39% <0.00%> (-60.61%)` | :arrow_down: |
   | [...nd/src/dashboard/components/gridComponents/Row.jsx](https://codecov.io/gh/apache/superset/pull/21821/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL1Jvdy5qc3g=) | `51.21% <0.00%> (-23.79%)` | :arrow_down: |
   | [.../CRUD/data/database/DatabaseModal/ExtraOptions.tsx](https://codecov.io/gh/apache/superset/pull/21821/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhYmFzZS9EYXRhYmFzZU1vZGFsL0V4dHJhT3B0aW9ucy50c3g=) | `75.00% <0.00%> (-11.96%)` | :arrow_down: |
   | [.../explore/exploreUtils/getParsedExploreURLParams.ts](https://codecov.io/gh/apache/superset/pull/21821/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvZXhwbG9yZVV0aWxzL2dldFBhcnNlZEV4cGxvcmVVUkxQYXJhbXMudHM=) | `83.33% <0.00%> (-8.10%)` | :arrow_down: |
   | [...nts/controls/DateFilterControl/DateFilterLabel.tsx](https://codecov.io/gh/apache/superset/pull/21821/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9EYXRlRmlsdGVyTGFiZWwudHN4) | `35.71% <0.00%> (-5.70%)` | :arrow_down: |
   | [...iews/CRUD/data/dataset/AddDataset/Header/index.tsx](https://codecov.io/gh/apache/superset/pull/21821/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhc2V0L0FkZERhdGFzZXQvSGVhZGVyL2luZGV4LnRzeA==) | `81.81% <0.00%> (-5.69%)` | :arrow_down: |
   | ... and [57 more](https://codecov.io/gh/apache/superset/pull/21821/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] stephenLYZ commented on pull request #21821: perf(native-filters): improve native filter modal form performance

Posted by GitBox <gi...@apache.org>.
stephenLYZ commented on PR #21821:
URL: https://github.com/apache/superset/pull/21821#issuecomment-1286403197

   /testenv up


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] stephenLYZ commented on pull request #21821: perf(native-filters): improve native filter modal form performance

Posted by GitBox <gi...@apache.org>.
stephenLYZ commented on PR #21821:
URL: https://github.com/apache/superset/pull/21821#issuecomment-1291995610

   @jinghua-qa Can you please help to test this PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org