-
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
Move ExpressionRenderer to setup instead of start #45141
Move ExpressionRenderer to setup instead of start #45141
Conversation
embeddables can rely on it without starting their plugins.
💚 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.
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.