From e974e43c22517c7ab84cddf9f6a69acea5eb2ad8 Mon Sep 17 00:00:00 2001 From: Untone Date: Mon, 22 Jan 2024 21:53:04 +0300 Subject: [PATCH] load-topics-on-create --- src/components/Views/PublishSettings/PublishSettings.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Views/PublishSettings/PublishSettings.tsx b/src/components/Views/PublishSettings/PublishSettings.tsx index 90c6b289..8e8429f9 100644 --- a/src/components/Views/PublishSettings/PublishSettings.tsx +++ b/src/components/Views/PublishSettings/PublishSettings.tsx @@ -1,6 +1,6 @@ import { redirectPage } from '@nanostores/router' import { clsx } from 'clsx' -import { lazy, Show } from 'solid-js' +import { createEffect, lazy, Show } from 'solid-js' import { createStore } from 'solid-js/store' import { ShoutForm, useEditorContext } from '../../../context/editor' @@ -9,7 +9,7 @@ import { useSession } from '../../../context/session' import { UploadedFile } from '../../../pages/types' import { router } from '../../../stores/router' import { hideModal, showModal } from '../../../stores/ui' -import { useTopicsStore } from '../../../stores/zine/topics' +import { loadAllTopics, useTopicsStore } from '../../../stores/zine/topics' import { Button } from '../../_shared/Button' import { Icon } from '../../_shared/Icon' import { Image } from '../../_shared/Image' @@ -40,6 +40,10 @@ export const PublishSettings = (props: Props) => { const { author } = useSession() const { sortedTopics } = useTopicsStore() + createEffect(async () => { + if (!sortedTopics()) await loadAllTopics() + }) + const composeDescription = () => { if (!props.form.description) { const cleanFootnotes = props.form.body.replaceAll(/.*?<\/footnote>/g, '')