From d4ce74b49117c9671eb3ad28b3824b531ab6a498 Mon Sep 17 00:00:00 2001 From: ilya-bkv Date: Thu, 21 Mar 2024 11:42:28 +0300 Subject: [PATCH] Hide modal after route to profile from another profile --- src/components/Views/Author/Author.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index ad9f5f66..4041aa2a 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -26,6 +26,7 @@ import { Loading } from '../../_shared/Loading' import { byCreated } from '../../../utils/sortby' import stylesArticle from '../../Article/Article.module.scss' import styles from './Author.module.scss' +import { hideModal, MODALS } from "../../../stores/ui"; type Props = { shouts: Shout[] @@ -40,13 +41,14 @@ export const AuthorView = (props: Props) => { const { loadSubscriptions } = useFollowing() const { sortedArticles } = useArticlesStore({ shouts: props.shouts }) const { authorEntities } = useAuthorsStore({ authors: [props.author] }) - const { page: getPage } = useRouter() + const { page: getPage, searchParams } = useRouter() const [isLoadMoreButtonVisible, setIsLoadMoreButtonVisible] = createSignal(false) const [isBioExpanded, setIsBioExpanded] = createSignal(false) const [followers, setFollowers] = createSignal([]) const [following, setFollowing] = createSignal>([]) const [showExpandBioControl, setShowExpandBioControl] = createSignal(false) const [commented, setCommented] = createSignal() + const modal = MODALS[searchParams().m] // current author const [author, setAuthor] = createSignal() @@ -92,7 +94,13 @@ export const AuthorView = (props: Props) => { } } - onMount(() => fetchData(props.authorSlug)) + onMount(() => { + fetchData(props.authorSlug) + + if (!modal) { + hideModal() + } + }); const loadMore = async () => { saveScrollPosition()