-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Console] Refactoring more legacy code and implementing minor fixes #51312
Conversation
… passing through of content type
… Doesn't really make sense. - make triple quote setting update in place
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
💚 Build Succeeded |
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.
@jloleysens nice job with the refactor. Looks great! I did some generally testing against Console and did not find any regressions.
{ | ||
files: ['src/legacy/core_plugins/console/**/*.{js,ts,tsx}'], | ||
rules: { | ||
'react-hooks/exhaustive-deps': 'off', |
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.
Can #49543 be closed once this PR is merged?
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.
Yep!
*/ | ||
|
||
import { Reducer } from 'react'; | ||
import { produce } from 'immer'; |
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.
TIL about immer
😄
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.
Haha yeah it's really great 🎉
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.
Talking about immer
, it seems we need to add this dependency into package.json
, I see it only in xpack/package.json
, but this is OSS plugin @jloleysens (curious if this code works at all in OSS-only build?)
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.
@azasypkin After building with node ./scripts/build.js --oss --docker --skip-archives --skip-os-packages
and opening console I saw the following:
I'll open a fix PR shortly 👍. Thanks for weighing in here!
@elasticmachine merge upstream |
💚 Build Succeeded |
…lastic#51312) * First part of context refactor * Finised "hook"ing in to new context for old editor output. Also fixed passing through of content type * Remove comment * - update console history behaviour - don't scroll into view on click. Doesn't really make sense. - make triple quote setting update in place
…51312) (#51622) * First part of context refactor * Finised "hook"ing in to new context for old editor output. Also fixed passing through of content type * Remove comment * - update console history behaviour - don't scroll into view on click. Doesn't really make sense. - make triple quote setting update in place
Summary
In preparation for future work on Console this contribution proposes we create state slices using React Context (similar to redux, but less verbose since the state model here isn't that big). Some features of the new model:
Future work this will compliment:
EditorContext
.RequestContext
we can consume this in the UI where we need itFixes included here:
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers