Conversation
|
Pinging @elastic/kibana-app (Team:KibanaApp) |
| visEditorController?: IEditorController; | ||
| }>({}); | ||
| const visEditorRef = useRef<HTMLDivElement>(null); | ||
| const visEditorRef = useRef<HTMLDivElement | null>(null); |
There was a problem hiding this comment.
nit: Docs note:
if you need the result of useRef to be directly mutable, include | null in the type of the generic argument.
That means, visEditorRef.current is mutable with such a type.
If you'll get rid of union type and leave only the HTMLDivElement, this will still save possible null value, but in that case visEditorRef.current is a read-only property.
There was a problem hiding this comment.
Yeah, that's exactly why I added it here :) Since the file now behaves slightly different I need to make sure visEditorRef has a value in the tests, since otherwise it does not run through the initialization phase, so I need it to be a MutualRef object in that case. This seemed for me to be the easiest way.
| const { chrome } = services; | ||
| const getVisInstance = async () => { | ||
| if (!valueInput || loaded.current) { | ||
| if (!valueInput || loaded.current || !visEditorRef.current) { |
There was a problem hiding this comment.
@ThomThomson Could you check if this is still working as expected? This should not break things theoretically, because the Editor would anyway not have worked if there was no HTML element passed into, just want to double check.
|
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]@kbn/optimizer bundle module count
async chunks size
page load bundle size
History
To update your PR or re-run it, just comment with: |
* Improve vis editor typings * Move VisEditorContructor to visualize * Fix tests * Fix typings Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* upstream/master: (34 commits) Improve vis editor typings (elastic#80004) Line Visualization improper scaling can result in gaps elastic#79663 (elastic#80135) [Security Solution][Timeline] Fix SelectableTimeline search (elastic#80128) move field_mapping util to saved_objects plugin (elastic#79918) [ML] Datagrid: Ensure column content with 'boolean' schema is not capitalized (elastic#80041) [CI] Correctly resolve repository root for JUnit reports (elastic#80226) [Ingest Manager] Fix package upgrade breaking after first rollover before new data has arrived (elastic#79887) [Security Solution] Fix positioning of Kibana banners list inside Sec… (elastic#80124) add missing await to fix test (elastic#80202) Revert test data changed in previous commit. (elastic#79479) [Security Solution] [Sourcerer] Jest beef up (elastic#79907) Re-enable transaction duration alert story (elastic#80187) [npm] remove canvas dep (elastic#80185) [DOCS] Redirects ILM docs to Elasticsearch reference (elastic#79798) [APM] Catch health status error from ML (elastic#80131) Fix layout and remove title for add alert popover. (elastic#77633) [Discover] Loading spinner cleanup (elastic#79819) [Security Solution] [Resolver] Remove related events api (elastic#79036) [Ingest Manager] Remove fields from index pattern during package uninstall (elastic#80082) do not refetch license if signature header absents from a response (elastic#79645) ...
* Improve vis editor typings * Move VisEditorContructor to visualize * Fix tests * Fix typings Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Summary
This improves the typings of the
VisType.editorkey.There should be no functional change introduced by this PR.
Checklist
Delete any items that are not applicable to this PR.
For maintainers