Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[lens] Editor frame initializes datasources and visualizations #36060
[lens] Editor frame initializes datasources and visualizations #36060
Changes from 1 commit
0410d71
513c71e
b2a536a
8b53dea
eadcb28
d63288c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Why initializing all datasources and visualizations? Is this for debugging purposes? If yes I would vote for adding dropdowns for switching between them because it's much closer to what this plugin will do in a finished product. IMO we should only initialize the initial datasource and show a spinner during that period (which means there has to be some indicator in the state that datasource initialization is currently in progress) and initialize the new datasource on switch
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 way of rendering agnostic components won't update them on state changes. Since we will have the same problem for rendering dimension editors, we should create a general purpose component which abstracts that away. Don't bother in this PR though, I'm going to implement this in a separate one.
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.
Do we want to hold information about the active data source and the mounted element in the plugin? This restricts us in only showing / managing a single editor frame at a time. We might want to have multiple "editor frame instances" later, especially for the embedding use case.
My proposed change is something like this:
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.
Even if we don't do this, the state about the active datasource should be managed inside the editor frame component, not the plugin - the editor frame will be able to change the datasource in the future which would require a callback like
onChangeDatasource
. The plugin doesn't need to know which datasource is currently used.The concrete proposal would be to pass in an
initialDatasource
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.
If we don't follow the
createInstance
proposal form above (and I think we should), we have to check whether render was already called on another element and clean up there: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.
Unnecessary
async
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.
Commented out code
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.
Commented out code
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.
Why is this async? Is the visualization allowed to query stuff during init? I was under the impression the visualization doesn't have to be initialized because it doesn't need to trigger any side effects
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.
Visualizations can have internal state just like datasources, and this is mostly for rehydrating from persisted state