-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
ref(discover): Remove usages of deprecatedRouteProps from Discover views
#104923
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
base: master
Are you sure you want to change the base?
Conversation
| } | ||
|
|
||
| function HomepageContainer(props: Props) { | ||
| export default function HomepageContainer() { |
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.
I noticed that our legacy redirect scheme to event details (from the event IDs in the Discover table) fails in dev-ui and devserver, so that's the one thing I wasn't able to test manually. On the preview deployment for the PR, the redirect "works", but redirects me to prod. Seems this happens for all of our preview deployments. Just wanted to make sure this is expected?
I think to fix this, we would want to migrate ProjectEventRedirect off of XHR and instead:
- Fetch the issue ID for the given event from the API
- Construct the URL for event details manually
I can make a follow-up for this if that sounds good.
| export default function ResultsContainer( | ||
| props: Omit<Props, 'api' | 'organization' | 'selection' | 'loading' | 'setSavedQuery'> | ||
| ) { | ||
| export default function ResultsContainer() { |
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.
Keeping wrapper around class component
| return ( | ||
| <PageFiltersContainer | ||
| disablePersistence={ | ||
| organization.features.includes('discover-query') && | ||
| !!(props.savedQuery || props.location.query.id) | ||
| organization.features.includes('discover-query') && !!location.query.id | ||
| } | ||
| skipLoadLastUsed={!!props.savedQuery} | ||
| skipLoadLastUsed={false} | ||
| // The Discover Results component will manage URL params, including page filters state | ||
| // This avoids an unnecessary re-render when forcing a project filter for team plan users | ||
| skipInitializeUrlParams |
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.
Bug: Setting skipLoadLastUsed to false causes last-used filters from local storage to override a saved query's filters, as local storage is loaded before the query is fetched.
Severity: HIGH | Confidence: High
🔍 Detailed Analysis
When a user opens a saved query, the PageFiltersContainer is initialized with skipLoadLastUsed={false}. This unconditionally loads the user's last-used page filters from local storage. This loading occurs before the SavedQueryAPI fetches the saved query's data. As a result, when the EventView is created, it uses the filters from local storage instead of the filters defined in the saved query, effectively overriding the saved query's intended project, environment, and date range settings.
💡 Suggested Fix
Revert the skipLoadLastUsed prop to its previous behavior. It should be set to true when a saved query is being loaded to prevent filters from local storage from being applied. The logic should be similar to the previous implementation: skipLoadLastUsed={!!props.savedQuery}.
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: static/app/views/discover/results.tsx#L1035-L1043
Potential issue: When a user opens a saved query, the `PageFiltersContainer` is
initialized with `skipLoadLastUsed={false}`. This unconditionally loads the user's
last-used page filters from local storage. This loading occurs before the
`SavedQueryAPI` fetches the saved query's data. As a result, when the `EventView` is
created, it uses the filters from local storage instead of the filters defined in the
saved query, effectively overriding the saved query's intended project, environment, and
date range settings.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 7607005
Migrates Discover views off of
deprecatedRouteProps.https://www.notion.so/sentry/Frontend-TSC-Project-Remove-all-uses-of-deprecatedRouteProps-true-26a8b10e4b5d8015a6a2dd14f9d41dd7