Fix reload page after foute from profile to another profile (#430)
This commit is contained in:
parent
e3c00cc6cd
commit
b84e7f43f7
|
@ -29,8 +29,6 @@ import stylesArticle from '../../Article/Article.module.scss'
|
|||
import styles from './Author.module.scss'
|
||||
|
||||
type Props = {
|
||||
shouts: Shout[]
|
||||
author: Author
|
||||
authorSlug: string
|
||||
}
|
||||
export const PRERENDERED_ARTICLES_COUNT = 12
|
||||
|
@ -39,8 +37,8 @@ const LOAD_MORE_PAGE_SIZE = 9
|
|||
export const AuthorView = (props: Props) => {
|
||||
const { t } = useLocalize()
|
||||
const { loadSubscriptions } = useFollowing()
|
||||
const { sortedArticles } = useArticlesStore({ shouts: props.shouts })
|
||||
const { authorEntities } = useAuthorsStore({ authors: [props.author] })
|
||||
const { sortedArticles } = useArticlesStore()
|
||||
const { authorEntities } = useAuthorsStore()
|
||||
const { page: getPage, searchParams } = useRouter()
|
||||
const [isLoadMoreButtonVisible, setIsLoadMoreButtonVisible] = createSignal(false)
|
||||
const [isBioExpanded, setIsBioExpanded] = createSignal(false)
|
||||
|
@ -200,10 +198,10 @@ export const AuthorView = (props: Props) => {
|
|||
</ul>
|
||||
</div>
|
||||
<div class={clsx('col-md-8', styles.additionalControls)}>
|
||||
<Show when={props.author?.stat?.rating || props.author?.stat?.rating === 0}>
|
||||
<Show when={author()?.stat?.rating || author()?.stat?.rating === 0}>
|
||||
<div class={styles.ratingContainer}>
|
||||
{t('All posts rating')}
|
||||
<AuthorShoutsRating author={props.author} class={styles.ratingControl} />
|
||||
<AuthorShoutsRating author={author()} class={styles.ratingControl} />
|
||||
</div>
|
||||
</Show>
|
||||
</div>
|
||||
|
|
|
@ -56,17 +56,11 @@ export const AuthorPage = (props: PageProps) => {
|
|||
|
||||
onCleanup(() => resetSortedArticles())
|
||||
|
||||
const usePrerenderedData = props.author?.slug === slug()
|
||||
|
||||
return (
|
||||
<PageLayout title={props.seo?.title || t('Discours')}>
|
||||
<ReactionsProvider>
|
||||
<Show when={isLoaded()} fallback={<Loading />}>
|
||||
<AuthorView
|
||||
author={usePrerenderedData ? props.author : null}
|
||||
shouts={usePrerenderedData ? props.authorShouts : null}
|
||||
authorSlug={slug()}
|
||||
/>
|
||||
<AuthorView authorSlug={slug()} />
|
||||
</Show>
|
||||
</ReactionsProvider>
|
||||
</PageLayout>
|
||||
|
|
|
@ -15,17 +15,17 @@ export const getImageUrl = (
|
|||
src: string,
|
||||
options: { width?: number; height?: number; noSizeUrlPart?: boolean } = {},
|
||||
) => {
|
||||
if (!src.includes('discours.io') && src.includes('http')) {
|
||||
return src
|
||||
}
|
||||
const filename = src.toLowerCase().split('/').pop()
|
||||
const ext = filename.split('.').pop()
|
||||
const isAudio = ext in ['wav', 'mp3', 'ogg', 'aif', 'flac']
|
||||
const base = isAudio ? cdnUrl : `${thumborUrl}/unsafe/`
|
||||
const suffix = isAudio || options.noSizeUrlPart ? '' : getSizeUrlPart(options)
|
||||
const subfolder = isAudio ? 'audio' : 'image'
|
||||
if (!src.includes('discours.io') && src.includes('http')) {
|
||||
return src
|
||||
}
|
||||
const filename = src.toLowerCase().split('/').pop()
|
||||
const ext = filename.split('.').pop()
|
||||
const isAudio = ext in ['wav', 'mp3', 'ogg', 'aif', 'flac']
|
||||
const base = isAudio ? cdnUrl : `${thumborUrl}/unsafe/`
|
||||
const suffix = isAudio || options.noSizeUrlPart ? '' : getSizeUrlPart(options)
|
||||
const subfolder = isAudio ? 'audio' : 'image'
|
||||
|
||||
return `${base}${suffix}production/${subfolder}/${filename}`
|
||||
return `${base}${suffix}production/${subfolder}/${filename}`
|
||||
}
|
||||
|
||||
export const getOpenGraphImageUrl = (
|
||||
|
|
Loading…
Reference in New Issue
Block a user