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

[Lens] Memoize editor frame #89865

Merged
merged 3 commits into from
Feb 4, 2021
Merged

Conversation

flash1293
Copy link
Contributor

@flash1293 flash1293 commented Feb 1, 2021

Memoizes editor frame rendering in Lens app. This avoid re-rendering the frame twice on every state change (because the onChange hook in the app is called which is causing a subsequent re-render of the frame.

Originally I planned to do this as part of #89690 but it's a quick win we can get in easily and IMHO the improvement is relevant enough to change it now

old:
Screenshot 2021-02-01 at 17 33 49

new (note the missing "mount" block):
Screenshot 2021-02-01 at 17 38 06

@flash1293 flash1293 added Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Feature:Lens v7.12.0 labels Feb 1, 2021
@@ -514,6 +522,12 @@ export function App({
}
};

const lastKnownDocRef = useRef(state.lastKnownDoc);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those are save to pass in via refs because they are only used in the onChange callback to compare

@flash1293 flash1293 marked this pull request as ready for review February 1, 2021 16:41
@flash1293 flash1293 requested a review from a team February 1, 2021 16:41
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@flash1293
Copy link
Contributor Author

@elasticmachine merge upstream

@flash1293
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Code LGTM, tested it locally, this is a nice improvement!

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
lens 873.7KB 875.0KB +1.3KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@flash1293 flash1293 merged commit 1818dd7 into elastic:master Feb 4, 2021
flash1293 added a commit to flash1293/kibana that referenced this pull request Feb 4, 2021
Copy link
Contributor

@dej611 dej611 left a comment

Choose a reason for hiding this comment

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

Tested on Chrome and FF 👍 . It is much more fluid the editor experience.

@dej611
Copy link
Contributor

dej611 commented Feb 4, 2021

Just realised I pressed submit on merge already happened :D

flash1293 added a commit that referenced this pull request Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.12.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants