diff --git a/app.config.ts b/app.config.ts index f8a88c67..77c79bcc 100644 --- a/app.config.ts +++ b/app.config.ts @@ -34,11 +34,6 @@ export default defineConfig({ https: true }, devOverlay: true, - build: { - chunkSizeWarningLimit: 1024, - target: 'esnext', - sourcemap: true - }, vite: { envPrefix: 'PUBLIC_', plugins: [!isVercel && mkcert(), nodePolyfills(polyfillOptions), sassDts()], @@ -49,6 +44,23 @@ export default defineConfig({ includePaths: ['./public', './src/styles'] } } as CSSOptions['preprocessorOptions'] + }, + build: { + chunkSizeWarningLimit: 800, + target: 'esnext', + sourcemap: true, + rollupOptions: { + // plugins: [visualizer()] + output: { + manualChunks: { + 'icons': ['./src/components/_shared/Icon/Icon.tsx'], + 'session': ['./src/context/session.tsx'], + 'editor': ['./src/context/editor.tsx'], + 'localize': ['./src/context/localize.tsx'], + 'connect': ['./src/context/connect.tsx'] + } + } + } } } } as SolidStartInlineConfig) diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index c52ccbe4..a459e9c4 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -182,19 +182,25 @@ export const AuthorView = (props: AuthorViewProps) => { }) const result = await authorCommentsFetcher() result && addReactions(result) - result && setCommented((prev) => [...new Set([...(prev || []), ...result])]) restoreScrollPosition() return result as LoadMoreItems } createEffect(() => setCurrentTab(params.tab)) + createEffect( on( - [author, commented], - ([a, ccc]) => a && setLoadMoreCommentsHidden(ccc?.length === a.stat?.comments), + [author, commentsByAuthor], + ([a, ccc]) => { + if (a && ccc && ccc[a.id]) { + setCommented(ccc[a.id]) + setLoadMoreCommentsHidden(ccc[a.id]?.length === a.stat?.comments) + } + }, {} ) ) + createEffect( on( [author, feedByAuthor], diff --git a/src/components/_shared/LoadMoreWrapper.tsx b/src/components/_shared/LoadMoreWrapper.tsx index 5254f3c1..ff53e9bd 100644 --- a/src/components/_shared/LoadMoreWrapper.tsx +++ b/src/components/_shared/LoadMoreWrapper.tsx @@ -49,10 +49,7 @@ export const LoadMoreWrapper = (props: LoadMoreProps) => { restoreScrollPosition() } - onMount(() => { - loadItems() - console.debug(`load on mount ${items()}`) - }) + onMount(loadItems) return ( <> diff --git a/src/intl/i18next.ts b/src/intl/i18next.ts index 0b3dcc29..ae8b87f4 100644 --- a/src/intl/i18next.ts +++ b/src/intl/i18next.ts @@ -4,8 +4,6 @@ import ICU from 'i18next-icu' import TimeAgo from 'javascript-time-ago' import enTime from 'javascript-time-ago/locale/en' import ruTime from 'javascript-time-ago/locale/ru' -import en from '~/intl/locales/en/translation.json' -import ru from '~/intl/locales/ru/translation.json' TimeAgo.addLocale(enTime) TimeAgo.addLocale(ruTime) @@ -13,7 +11,8 @@ TimeAgo.addLocale(ruTime) export const i18nextInit = async (lng = 'ru') => { if (!i18next.isInitialized) { console.debug('[i18next] initializing...') - + const en = await import('~/intl/locales/en/translation.json') + const ru = await import('~/intl/locales/ru/translation.json') await i18next .use(HttpApi) .use(ICU) diff --git a/src/routes/feed/[...order].tsx b/src/routes/feed/[...order].tsx index bd466b56..2d72e795 100644 --- a/src/routes/feed/[...order].tsx +++ b/src/routes/feed/[...order].tsx @@ -1,7 +1,6 @@ import { RouteSectionProps, createAsync, useSearchParams } from '@solidjs/router' import { Client } from '@urql/core' import { createEffect, createMemo } from 'solid-js' -import { AUTHORS_PER_PAGE } from '~/components/Views/AllAuthors/AllAuthors' import { Feed } from '~/components/Views/Feed' import { FeedProps } from '~/components/Views/Feed/Feed' import { LoadMoreItems, LoadMoreWrapper } from '~/components/_shared/LoadMoreWrapper' @@ -125,7 +124,7 @@ export default (props: RouteSectionProps<{ shouts: Shout[]; topics: Topic[] }>) key="feed" desc="Independent media project about culture, science, art and society with horizontal editing" > - +