-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
ref(insights): Combine data loading + widget rendering for Insights -> Http pages #89325
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
ref(insights): Combine data loading + widget rendering for Insights -> Http pages #89325
Conversation
…> Http pages As part of an effort to be able to [deeplink to charts via the Releases Drawer](#88560), we need to move data fetching + chart rendering into a self-contained component (with a unique id). This refactors the widgets on `httpLandingPage` and `httpDomainSummaryPage` so that we get an idea of what this will look like.
import {BASE_FILTERS} from 'sentry/views/insights/http/settings'; | ||
import {SpanMetricsField} from 'sentry/views/insights/types'; | ||
|
||
export function useHttpDomainSummaryFilter() { |
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.
Are these generally pretty static per "page"?
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.
Generally, all charts at the top of a page share filters, and the table under them has its own set of filters that's close to, but not exactly the same as the chart filters. So, this hook might be better if the word Chart
appeared in it?
static/app/views/insights/common/components/widgets/httpDomainSummaryDurationWidget.tsx
Outdated
Show resolved
Hide resolved
isPending: isDurationDataLoading, | ||
data: durationData, | ||
error: durationError, |
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.
probably don't need these aliases? maybe makes it easier to read the diffs as we're transitioning
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.
You can remove the aliases if you want. The aliases help a lot when fetching multiple series per page
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.
Gonna leave them for now, we can go back to update it later
@@ -22,14 +18,15 @@ import {ModulePageProviders} from 'sentry/views/insights/common/components/modul | |||
import {ModuleBodyUpsellHook} from 'sentry/views/insights/common/components/moduleUpsellHookWrapper'; | |||
import {ReadoutRibbon, ToolRibbon} from 'sentry/views/insights/common/components/ribbon'; | |||
import {getTimeSpentExplanation} from 'sentry/views/insights/common/components/tableCells/timeSpentCell'; | |||
import {useHttpDomainSummaryFilter} from 'sentry/views/insights/common/components/widgets/hooks/useHttpDomainSummaryFilter'; | |||
import HttpDomainSummaryDurationWidget from 'sentry/views/insights/common/components/widgets/httpDomainSummaryDurationWidget'; |
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.
See https://github.com/getsentry/sentry/pull/89045/files#diff-886e46c8485496b33137c9770f4eb4fb6e1085c7e6e0fbafdd5721d4310b74e3R33-R62 on how we're going to use these widgets -- these are default exports to make it easier to dynamically import and render.
@@ -260,6 +260,8 @@ describe('HTTPLandingPage', function () { | |||
it('fetches module data', async function () { | |||
render(<HTTPLandingPage />, {organization}); | |||
|
|||
await waitForElementToBeRemoved(() => screen.queryAllByTestId('loading-indicator')); |
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.
Oh this was from the PoC where we dynamically loaded the widgets. Still makes sense here that we'd wait for loading components to go away before we check the mocked requests.
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.
Great! I'm happy to mash approve, but I also wanted to ask about the names. Tables are also technically widgets, so I think it'd be clearer if the components and their IDs has Chart
in them somewhere, or were namespaced in a folder that specified they're charts. Not huge, but would help!
import {BASE_FILTERS} from 'sentry/views/insights/http/settings'; | ||
import {SpanMetricsField} from 'sentry/views/insights/types'; | ||
|
||
export function useHttpDomainSummaryFilter() { |
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.
Generally, all charts at the top of a page share filters, and the table under them has its own set of filters that's close to, but not exactly the same as the chart filters. So, this hook might be better if the word Chart
appeared in it?
isPending: isDurationDataLoading, | ||
data: durationData, | ||
error: durationError, |
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.
You can remove the aliases if you want. The aliases help a lot when fetching multiple series per page
static/app/views/insights/common/components/widgets/httpDomainSummaryDurationWidget.tsx
Outdated
Show resolved
Hide resolved
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.
lol Cursor decided to rewrite this file?????????????????????
54bf4ae
to
646513f
Compare
Renamed everything to include |
This broke in #89325 We should be passing in `location.query.domainsSort` into decodeSorts and not the string `domainsSort`! Also added a test case to ensure sort always works off the query param
This broke in #89325 We should be passing in `location.query.domainsSort` into decodeSorts and not the string `domainsSort`! Also added a test case to ensure sort always works off the query param
…> Http pages (#89325) As part of an effort to be able to [deeplink to charts via the Releases Drawer](#88560), we need to move data fetching + chart rendering into a self-contained component (with a unique id). This refactors the widgets on `httpLandingPage` and `httpDomainSummaryPage` so that we get an idea of what this will look like before continuing on to do others.
This broke in #89325 We should be passing in `location.query.domainsSort` into decodeSorts and not the string `domainsSort`! Also added a test case to ensure sort always works off the query param
As part of an effort to be able to deeplink to charts via the Releases Drawer, we need to move data fetching + chart rendering into a self-contained component (with a unique id).
This refactors the widgets on
httpLandingPage
andhttpDomainSummaryPage
so that we get an idea of what this will look like before continuing on to do others.