[Console] Refactoring more legacy code and implementing minor fixes#51312
[Console] Refactoring more legacy code and implementing minor fixes#51312jloleysens merged 5 commits intoelastic:masterfrom
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 |
alisonelizabeth
left a comment
There was a problem hiding this comment.
@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', |
| */ | ||
|
|
||
| import { Reducer } from 'react'; | ||
| import { produce } from 'immer'; |
There was a problem hiding this comment.
Haha yeah it's really great 🎉
There was a problem hiding this comment.
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.
@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.RequestContextwe 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