Move ExpressionRenderer to setup instead of start#45141
Move ExpressionRenderer to setup instead of start#45141chrisdavies wants to merge 1 commit intoelastic:masterfrom
Conversation
embeddables can rely on it without starting their plugins.
💚 Build Succeeded |
wylieconlon
left a comment
There was a problem hiding this comment.
This change is fine, but you've definitely removed ExpressionRenderer from the start phase- I think Lens is the only consumer for now, but please update the dev docs which say that it's available in both setup and start
|
I'm not sure whether that's the right route.
That was a small error on my part, sorry for the confusion. I forgot to call our shimmed That approach in this PR works with the current code, but it's also dirty because it's moving the lifecycle problem to another place - with this setup the expression loader is exposed through the renderer before the inspector is registered. The code of the loader is operating under the assumption that the inspector dependency is available which isn't the case anymore if you can access it in the |
|
Closing since @wylieconlon said that my info was wrong. Setup is the method that is being discouraged, and start is the one that is going to be most common. If that's true, then we should keep the code as is. |
|
ExpressionRenderer (or ExpressionDataLoder) should not be exposed in the setup lifecycle method. For this reason ExpressionRenderer (and all the other functions allowing you to execute expressions) are only available in the start lifecycle method, when we can be sure all the plugins had a chance to register their functions. In the start lifecycle method adding to the registries is no longer possible. |
When working on Lens, we ran into an issue where we were unable to access ExpressionRenderer in our plugin's setup method. Our plugin's start method was never called (e.g. when embedding in dashboards). This moves the ExpressionRenderer to setup so that plugins can use it in their setup.
Dev Docs
Plugins may now access the expression renderer in their setup phase as well as their start phase.