-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref(feedback): extract screenshot fetching into a hook (#67797)
hook will be modified as needed, but a starting point to make it easier to implement core functionality of rendering the screenshots while using our own UI (for #67707)
- Loading branch information
1 parent
48db417
commit f9501d7
Showing
2 changed files
with
31 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
static/app/components/feedback/feedbackItem/useFeedbackHasScreenshot.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {useMemo} from 'react'; | ||
|
||
import {useFetchEventAttachments} from 'sentry/actionCreators/events'; | ||
import type {Event} from 'sentry/types'; | ||
import useOrganization from 'sentry/utils/useOrganization'; | ||
|
||
interface Props { | ||
event: Event; | ||
projectSlug: string; | ||
} | ||
|
||
export default function useFeedbackScreenshot({projectSlug, event}: Props) { | ||
const organization = useOrganization(); | ||
const {data: attachments} = useFetchEventAttachments({ | ||
orgSlug: organization.slug, | ||
projectSlug, | ||
eventId: event.id, | ||
}); | ||
|
||
const screenshots = useMemo(() => { | ||
return attachments ?? []; | ||
}, [attachments]); | ||
|
||
return { | ||
screenshots, | ||
}; | ||
} |