-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[ML] Improving model snapshot revert UI experience #88588
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
Merged
jgowdyelastic
merged 4 commits into
elastic:master
from
jgowdyelastic:improve-model-snapshot-revert-UI-experience
Jan 21, 2021
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e897daa
[ML] Improving model snapshot revert UI experience
jgowdyelastic bd0ae2d
removing button disabling
jgowdyelastic 6f1867d
updating component is mounted check
jgowdyelastic 2c1e579
Merge branch 'master' into improve-model-snapshot-revert-UI-experience
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid the
letand resetting the variable on every render we use this alternative pattern in some places: https://github.com/elastic/kibana/blob/master/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/outlier_exploration/use_outlier_data.ts#L81We discussed making a reusable custom hook in the past but didn't get around to do it. Here's the PR that originally introduced it: #81123
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a look at other similar examples in our code, but could not find one where the guard variable is used in a separate function and so needed to in the outer scope.
I might missing something, but using a
constwrapper around the variable won't make any difference? Both will be redefined on render.vs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right this is different because of the additional outside callback. In the other examples the difference was that everything could be kept within the
useEffect.As an alternative you could use a refresh value to trigger the
useEffectinstead of directly callingloadModelSnapshots().Something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated this check so it now uses
useRefto keep track of the flag for whether the component is mounted.in 6f1867d