-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(widget-viewer): Render with new visualization widget #105687
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
feat(widget-viewer): Render with new visualization widget #105687
Conversation
| (() => { | ||
| const plottables = transformLegacySeriesToPlottables( | ||
| seriesData, | ||
| seriesResultsType, | ||
| widget | ||
| ); | ||
|
|
||
| if (plottables.length === 0) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <TimeSeriesWidgetVisualization | ||
| plottables={plottables} | ||
| releases={releases} | ||
| showReleaseAs="bubble" | ||
| onZoom={(_event, chart) => { | ||
| onZoom(_event, chart); | ||
| setChartUnmodified(false); | ||
| }} | ||
| onLegendSelectionChange={selected => { | ||
| widgetLegendState.setWidgetSelectionState(selected, widget); | ||
| trackAnalytics('dashboards_views.widget_viewer.toggle_legend', { | ||
| organization, | ||
| widget_type: widget.widgetType ?? WidgetType.DISCOVER, | ||
| display_type: widget.displayType, | ||
| }); | ||
| }} | ||
| legendSelection={widgetLegendState.getWidgetSelectionState(widget)} | ||
| pageFilters={modalSelection} | ||
| /> | ||
| ); | ||
| })() |
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 IIFE is kind of gross, should I pull it out into an actual component? 😅
The widget viewer has this pattern of:
A: I have memoized data, I'll just render the chart without the querying components
B: I don't have data, so I'll render "higher" up the component tree to get the querying
|
Drafting this for now, I think there might be regressions in the confidence footers for spans widgets if I do this. |
| renderErrorMessage={errorMessage => | ||
| errorMessage ? <div>{errorMessage}</div> : null | ||
| } | ||
| /> |
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.
Zoom in fresh data path causes data-axis mismatch
When using the fresh data path with VisualizationWidget, zooming causes a mismatch between the chart's x-axis and the displayed data. The VisualizationWidget doesn't pass pageFilters or onZoom to the inner TimeSeriesWidgetVisualization, so when the user zooms, the default behavior updates the URL with the new date range. However, VisualizationWidget continues to fetch data using modalSelection (which isn't updated by URL changes - only by the onZoom callback or browser back navigation). The result is that after zooming, TimeSeriesWidgetVisualization reads the new date range from usePageFilters() for its x-axis, but displays data that was fetched for the old date range.
|
This pull request has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you add the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
Converts the widget viewer modal to render with the new visualization timeseries widgets. I just prompted cursor for this and it passes all of the existing tests (minus where I had to update some mock values because we handle empty data differently) and I think the implementation is pretty minimal to get the widget viewer modal to work.