Try go back if close media modal
This commit is contained in:
parent
79aaa04af3
commit
49c04a4259
1 changed files with 10 additions and 5 deletions
|
@ -55,6 +55,7 @@ function resetScrollPosition(id) {
|
||||||
function StatusPage(params) {
|
function StatusPage(params) {
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
const { masto, instance } = api({ instance: params.instance });
|
const { masto, instance } = api({ instance: params.instance });
|
||||||
|
const snapStates = useSnapshot(states);
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const mediaParam = searchParams.get('media');
|
const mediaParam = searchParams.get('media');
|
||||||
const mediaOnlyParam = searchParams.get('media-only');
|
const mediaOnlyParam = searchParams.get('media-only');
|
||||||
|
@ -117,12 +118,16 @@ function StatusPage(params) {
|
||||||
instance={instance}
|
instance={instance}
|
||||||
index={mediaIndex - 1}
|
index={mediaIndex - 1}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
if (showMediaOnly) {
|
if (snapStates.prevLocation) {
|
||||||
location.hash = closeLink;
|
history.back();
|
||||||
} else {
|
} else {
|
||||||
searchParams.delete('media');
|
if (showMediaOnly) {
|
||||||
searchParams.delete('mediaStatusID');
|
location.hash = closeLink;
|
||||||
setSearchParams(searchParams);
|
} else {
|
||||||
|
searchParams.delete('media');
|
||||||
|
searchParams.delete('mediaStatusID');
|
||||||
|
setSearchParams(searchParams);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Add table
Reference in a new issue