fix(sqllab): rendering performance regression #23695
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
Alternative solution of #23653
When a schema contains a humorous table list, rendering cost of SqlEditorLeftBar is heavy since it requires to iterate millions items. To avoid the lag of using sql editor, we should avoid the LeftBar rendering while typing.
This commit fixes the
useSelector
in SqlEditor which triggers the re-rendering of SqlEditorLeftBar anytime redux action triggered.P.S. - Found the root cause from https://github.com/apache/superset/pull/21320/files#diff-dac1ba995e65dfae7c9aa7a0a794036ace1eb83814e2101d354752da2bb41dfdR166 which is migrated from PureComponent to functional component without shallowEqual which causes the regression
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
After (no lag while typing):
after--rendering-perf.mov
Before (typing at same speed):
before--rendering-perf.mov
TESTING INSTRUCTIONS
open sqllab with a list of > 100,000 tables
typing in the sql editor
ADDITIONAL INFORMATION