-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[CCR] Refactor redux for Auto-follow pattern detail panel #27491
Merged
sebelga
merged 10 commits into
elastic:feature/ccr
from
sebelga:feature/ccr_refactor_redux
Dec 21, 2018
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
43db32e
[CCR] Refactor redux for Auto-follow pattern detail panel
sebelga a7e764a
[CCR] Small refactor
sebelga d173c56
[CCR] Change to present tense
sebelga f5df213
[CCR] Display auto-follow pattern name even if it does not exist
sebelga ae7947e
[CCR] Use href to edit auto-follow pattern + remove middelware to upd…
sebelga e33a410
Merge branch 'feature/ccr' into feature/ccr_refactor_redux
sebelga 591a536
[CCR] Fix navigation back bug + set 2 ids for detail and edit an auto…
sebelga 0c4af91
[CCR] Replace api middleware with redux-thunk action
sebelga dd4fcbb
Merge branch 'feature/ccr' into feature/ccr_refactor_redux
sebelga 3d0f446
[CCR] Show detail footer close button even when cluster is not valid
sebelga 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 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 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 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 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 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 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 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
Oops, something went wrong.
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.
Just a personal DX anecdote... as I read this code, I found myself having to trace the logic through three lifecycle methods:
componentDidMount
,getDerivedStateFromProps
, andcomponentDidUpdate
. I then had to also factor in what would happen when the user clicks a row (a new pattern is selected, triggeringgetDerivedStateFromProps
). This took me a few minutes to wrap my head around, and then I was still left wondering why we're storinglastAutoFollowPatternId
. Through experimentation by removing the logic it supports, I found that its purpose is to prevent an infinite render loop.To be honest, I feel like this code has become more complex with this change. What is the benefit this complexity brings us?
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.
ComponentDidMount
is pretty clear I think, it mounts and checks for the presence of a pattern in the query params. I understand what u say about the 2 other lifecycle methods, I will see how this could be improved.There is never a benefit when complexity comes in 😊 I thought that using a middleware to change a URL on a single page was also a bit complex, mainly because you had to remember that it existed and that it was there that the search params were being changed. So I tried to move the logic as close as possible to the page (section) component.