-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
ref(ui): deprecate useProjects() without slugs #104462
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
static/app/views/performance/newTraceDetails/traceDrawer/details/missingInstrumentation.tsx
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #104462 +/- ##
========================================
Coverage 80.51% 80.51%
========================================
Files 9348 9348
Lines 399919 399892 -27
Branches 25651 25648 -3
========================================
- Hits 322005 321990 -15
+ Misses 77466 77454 -12
Partials 448 448 |
| const organization = useOrganization(); | ||
|
|
||
| const project = useProjects().projects.find(p => { | ||
| const {projects} = useProjects({slugs: props.projectId ? [props.projectId] : []}); |
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 think this one should just be empty if no projectId is set
| trail.type === 'profile summary' || trail.type === 'flamechart' | ||
| ) | ||
| .map(trail => trail.payload.projectSlug); | ||
| const {projects} = useProjects({slugs: projectSlugs}); |
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.
theres gotta be a better way to do breadcrumbs than pulling in projects like this - might need to just look at the payload. if its got slug, it might have name?
| ...props | ||
| }: WrapperProps) { | ||
| const {projects} = useProjects(); | ||
| const {projects} = useProjects({slugs: projectSlug ? [projectSlug] : []}); |
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.
similar to the profiling one, project should be empty if no projectId? thus no projects defined?
|
|
||
| export function TransactionCell({project, transaction, transactionMethod}: Props) { | ||
| const projects = useProjects(); | ||
| const {projects} = useProjects({slugs: project ? [project] : []}); |
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.
q: is project optional here becauase its not always present in the cells? does that mean we only need to look up project when its present similar to the other concerns with props above?
| } = useGroup({groupId}); | ||
|
|
||
| const groupProjectSlug = groupData?.project?.slug; | ||
| const {projects} = useProjects({slugs: groupProjectSlug ? [groupProjectSlug] : []}); |
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 project slug isnt found we should hard error on the group - it means the project's missing/deleted/similar
| const theme = useTheme(); | ||
| const {projects} = useProjects(); | ||
| const projectSlug = node.value.project_slug ?? node.event?.projectSlug; | ||
| const {projects} = useProjects({slugs: projectSlug ? [projectSlug] : []}); |
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.
hard error on missing slug i believe - someone correct me if im wrong
| const location = useLocation(); | ||
| const theme = useTheme(); | ||
| const {projects} = useProjects(); | ||
| const projectSlug = node.value.project_slug ?? node.event?.projectSlug; |
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.
hard error on missing slug i believe - someone correct me if im wrong
c3bbdac to
4ac7fcf
Compare
4ac7fcf to
a5bf981
Compare
a5bf981 to
4947b9a
Compare
4947b9a to
9d61aff
Compare
| 'This usage is deprecated and may break when all_projects=1 is removed. ' + | ||
| 'Pass specific slugs to ensure projects are fetched on-demand.' | ||
| ); | ||
| } |
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: Deprecation warning fires repeatedly on every render
The console.warn for deprecation is executed directly in the function body rather than inside a useEffect or with a ref guard. This means the warning will fire on every single re-render of any component calling useProjects() without slugs, spamming the console with repeated warnings. The warning needs to be deduplicated, typically by using a ref to track whether it has already warned, or by placing it in a useEffect with empty dependencies.
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.
seems fine
Add a development-time console warning when useProjects() is called without the slugs parameter. This prepares for removing the all_projects=1 bootstrap fetch by encouraging explicit project fetching. Updates 18 components to pass specific slugs to useProjects(), ensuring they will continue working when projects are no longer pre-loaded.
bf7c52d to
34f7904
Compare
| }: ContinuousProfileProviderProps) { | ||
| const api = useApi(); | ||
| const {projects} = useProjects(); | ||
| const {projects} = useProjects({slugs: projectSlug ? [projectSlug] : []}); |
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: Missing fetch state check causes false Sentry errors
The ContinuousProfileProvider now uses useProjects with specific slugs, but doesn't destructure the fetching state. When the project needs to be fetched from the API (not already in store), projects will be empty during the fetch. The useLayoutEffect runs immediately with the empty array, finds no project, and logs "Failed to fetch continuous profile - project not found" to Sentry - even though the project exists and is just being loaded. This causes false positive error reports. The component needs to check fetching before treating a missing project as an error.
Add a development-time console warning when useProjects() is called without the slugs parameter. This prepares for removing the all_projects=1 bootstrap fetch by encouraging explicit project fetching.
Updates 18 components to pass specific slugs to useProjects(), ensuring they will continue working when projects are no longer pre-loaded.
Refs #104436