[Console] Toward a more reactive data flow model#45627
Merged
jloleysens merged 7 commits intoelastic:masterfrom Sep 16, 2019
Merged
[Console] Toward a more reactive data flow model#45627jloleysens merged 7 commits intoelastic:masterfrom
jloleysens merged 7 commits intoelastic:masterfrom
Conversation
Introduced EditorContext with useReducer pattern (Read & Action)
Refactored old app startup ('./app.js')
Refactored most of input.js
Removed editor instances from services
Contributor
|
Pinging @elastic/es-ui |
Contributor
💚 Build Succeeded |
sebelga
approved these changes
Sep 16, 2019
Contributor
sebelga
left a comment
There was a problem hiding this comment.
LGTM! Thanks for making those changes, it already looks much better. I made a few comments in the code. Tested locally and did not see any regression.
| onEditorReady({ editor: editorInstanceRef.current, element: editorRef.current! }); | ||
| editorInstanceRef.current = initializeInput($editor, $actions); | ||
|
|
||
| if (previousStateLocation === 'stored') { |
Contributor
There was a problem hiding this comment.
I am not sure previousStateLocation is yet used, do we need it for now? In which scenario is the loadRemoteState() called?
Contributor
Author
There was a problem hiding this comment.
Yep it's not being used currently. It has been ported over from pre-existing functionality (where it looks like it was also not used, but has tests written for it).
While still trying to figure out where this was used I would like to keep this for now.
...ugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor.tsx
Outdated
Show resolved
Hide resolved
...ugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor.tsx
Outdated
Show resolved
Hide resolved
Contributor
Author
|
@elasticmachine merge upstream |
Contributor
💚 Build Succeeded |
…ole_app_data_flow * 'master' of github.com:elastic/kibana: [Console] Fix leaky mappings subscription (elastic#45646) TypeScriptify index_patterns/index_patterns/flatten_hit.js (elastic#45269) # Conflicts: # src/legacy/core_plugins/console/np_ready/public/application/containers/main/main.tsx # src/legacy/core_plugins/console/public/quarantined/src/app.js
Contributor
💚 Build Succeeded |
jloleysens
added a commit
to jloleysens/kibana
that referenced
this pull request
Sep 30, 2019
* First steps toward editor context (code not working here!)
* WiP, I broke some things
* Initial refactor to more react-like data flow
Introduced EditorContext with useReducer pattern (Read & Action)
Refactored old app startup ('./app.js')
Refactored most of input.js
Removed editor instances from services
* Clean up
* Better naming for es request callback
jloleysens
added a commit
that referenced
this pull request
Sep 30, 2019
* First steps toward editor context (code not working here!)
* WiP, I broke some things
* Initial refactor to more react-like data flow
Introduced EditorContext with useReducer pattern (Read & Action)
Refactored old app startup ('./app.js')
Refactored most of input.js
Removed editor instances from services
* Clean up
* Better naming for es request callback
4 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
This PR is a continuation of #43346
It specifically focusses on refactoring items that were not included in the initial migration to NP Ready. Specifically:
app.jsand legacy initialisationinput.jsinitialisation logicoutput.jsinitialisation logicA lot of the logic for managing editor state was still in the quarantined section of the code base. This PR proposes an alternate model where we use React's context to drive UI updates.
How to review
There are two primary ways that this PR should be reviewed:
history.tsservice (i.e., is it sensible to opt out of the React model for this more special case or is there another solution?)EditorRegistry. This is a stateful singleton where editor instances are stored outside of their respective components. The thinking here is that ace specific APIs should be kept in legacy.