mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 14:16:39 +01:00
Use useCallback for this
This commit is contained in:
parent
71f177bebe
commit
98e82a68fd
1 changed files with 18 additions and 16 deletions
|
@ -110,16 +110,7 @@ function StatusPage(params) {
|
|||
? mediaStatus?.mediaAttachments
|
||||
: heroStatus?.mediaAttachments;
|
||||
|
||||
return (
|
||||
<div class="deck-backdrop">
|
||||
{showMedia ? (
|
||||
mediaAttachments?.length ? (
|
||||
<MediaModal
|
||||
mediaAttachments={mediaAttachments}
|
||||
statusID={mediaStatusID || id}
|
||||
instance={instance}
|
||||
index={mediaIndex - 1}
|
||||
onClose={() => {
|
||||
const handleMediaClose = useCallback(() => {
|
||||
if (
|
||||
!window.matchMedia('(min-width: calc(40em + 350px))').matches &&
|
||||
snapStates.prevLocation
|
||||
|
@ -134,7 +125,18 @@ function StatusPage(params) {
|
|||
setSearchParams(searchParams);
|
||||
}
|
||||
}
|
||||
}}
|
||||
}, [showMediaOnly, closeLink, snapStates.prevLocation]);
|
||||
|
||||
return (
|
||||
<div class="deck-backdrop">
|
||||
{showMedia ? (
|
||||
mediaAttachments?.length ? (
|
||||
<MediaModal
|
||||
mediaAttachments={mediaAttachments}
|
||||
statusID={mediaStatusID || id}
|
||||
instance={instance}
|
||||
index={mediaIndex - 1}
|
||||
onClose={handleMediaClose}
|
||||
/>
|
||||
) : (
|
||||
<div class="media-modal-container loading">
|
||||
|
|
Loading…
Reference in a new issue