author-page-view

This commit is contained in:
Untone 2024-07-13 10:02:05 +03:00
parent b7e775eeea
commit 0192acb8a4
3 changed files with 23 additions and 19 deletions

View File

@ -1,5 +1,5 @@
import { SolidStartInlineConfig, defineConfig } from '@solidjs/start/config' import { SolidStartInlineConfig, defineConfig } from '@solidjs/start/config'
import { visualizer } from "rollup-plugin-visualizer" import { visualizer } from 'rollup-plugin-visualizer'
import mkcert from 'vite-plugin-mkcert' import mkcert from 'vite-plugin-mkcert'
import { nodePolyfills } from 'vite-plugin-node-polyfills' import { nodePolyfills } from 'vite-plugin-node-polyfills'
import sassDts from 'vite-plugin-sass-dts' import sassDts from 'vite-plugin-sass-dts'
@ -48,7 +48,7 @@ export default defineConfig({
chunkSizeWarningLimit: 1024, chunkSizeWarningLimit: 1024,
target: 'esnext', target: 'esnext',
rollupOptions: { rollupOptions: {
plugins: [visualizer(), ] plugins: [visualizer()]
} }
}, },
server: { server: {

View File

@ -80,7 +80,9 @@ export const AuthorView = (props: Props) => {
// 1 // проверяет не собственный ли это профиль, иначе - загружает // 1 // проверяет не собственный ли это профиль, иначе - загружает
const [isFetching, setIsFetching] = createSignal(false) const [isFetching, setIsFetching] = createSignal(false)
createEffect( createEffect(
on([() => session()?.user?.app_data?.profile, () => props.authorSlug || ''], async ([me, slug]) => { on(
[() => session()?.user?.app_data?.profile, () => props.authorSlug || ''],
async ([me, slug]) => {
console.debug('check if my profile') console.debug('check if my profile')
const my = slug && me?.slug === slug const my = slug && me?.slug === slug
if (my) { if (my) {
@ -95,7 +97,9 @@ export const AuthorView = (props: Props) => {
await loadAuthor({ slug }) await loadAuthor({ slug })
setIsFetching(false) // Сброс состояния загрузки после завершения setIsFetching(false) // Сброс состояния загрузки после завершения
} }
}, {defer: true}) },
{ defer: true }
)
) )
// 2 // догружает подписки автора // 2 // догружает подписки автора
@ -132,7 +136,7 @@ export const AuthorView = (props: Props) => {
const ccc = await commentsFetcher() const ccc = await commentsFetcher()
if (ccc) setCommented((_) => ccc || []) if (ccc) setCommented((_) => ccc || [])
} }
}, }
// { defer: true }, // { defer: true },
) )
) )

View File

@ -79,7 +79,7 @@ export default (props: RouteSectionProps<{ articles: Shout[]; author: Author; to
: getImageUrl('production/image/logo_image.png') : getImageUrl('production/image/logo_image.png')
) )
const selectedTab = createMemo(() => params.tab in ['followers', 'shouts'] ? params.tab : 'name') const selectedTab = createMemo(() => (params.tab in ['followers', 'shouts'] ? params.tab : 'name'))
return ( return (
<ErrorBoundary fallback={(_err) => <FourOuFourView />}> <ErrorBoundary fallback={(_err) => <FourOuFourView />}>
<Suspense fallback={<Loading />}> <Suspense fallback={<Loading />}>