-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[TSVB] In the case of 2 or more panels on the dashboard, TSVB renderComplete fires 2 times #143999
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
Conversation
Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors) |
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.
Wow, good catch. It works correctly for most cases, but there's one more that I introduced that should be addressed. When creating annotation fetching logic, I also used indexPatterns.create
so for the charts with Lens annotations we'll have the same problem (render twice):
The solution would be to implement the same thing (cachedDataView search first) here:
https://github.com/elastic/kibana/blob/main/src/plugins/event_annotation/common/fetch_event_annotations/request_event_annotations.ts#L95
And you'll have to also update tests in src/plugins/event_annotation/public/fetch_event_annotations/fetch_event_annotations.test.ts
Let me know if you need any help with it.
Good point @mbondyra , I think due to the fact of usage of that wrong pattern from the different places we should fix that in a different way. @elastic/kibana-app-services maybe we should introduce new method e.g. |
I think I'd go in another direction, perhaps you can tell me why I'm wrong. Part of me would like to see these methods named a bit better but I guess continuing with the current names is okay. |
@mattkime Renaming to About checking cache in the In general, the current approach looks like: I just wanted to show that if we interrupt the create method and return the value from the cache, in fact it will be a Promise that will never be resolved |
@alexwizp I still need to take a closer look at this. "At this step, we have in the cache a promise of an uninitialized data view" shouldn't be happening. It would be nice to figure out a way to unblock further work while properly addressing this. This shouldn't take too long but I understand that other things need to be completed. |
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.
As for the bug, it is fixed 👌🏼
Testing log
- multiple tsvb vises on Dashboard with Lens visualization
- single tsvb vis on Dashboard with Lens visualization
- Canvas check
@elasticmachine merge upstream |
@elasticmachine merge upstream |
…omplete fires 2 times
b7d787e
to
8556f35
Compare
@@ -929,6 +929,30 @@ export class DataViewsService { | |||
return indexPattern; |
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.
It would be nice if dataViewCache.set
was called in create
so that createFromSpec
only creates the dataView and isn't concerned with the cache. Also, we want to clear the cache entry if creating the data view fails.
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.
it's a really cool idea! thanks, updated
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.
changes lgtm, good work!
@elastic/kibana-operations please review limits |
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Page load bundle
Unknown metric groupsESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @alexwizp |
Closes: #143556, Closes: #144253
Root cause
TSVB
usesuseEfect
to change theDataView
. The problem is thatesaggs.ts
callsindexPatterns.create
which updates the link to the cachedDataView
each timeI don't know why it was implemented that way, but it looks like we can try to get a value from the cache before creating a new one.
Screens
With that changes TSVB works fine
Screen.Recording.2022-10-26.at.13.30.50.mov