Open platform to collect and prioritize feedback
UX issues when you remove the title and have a template fixed
Matt Roberts74e9b79b5cc3
diff --git a/public/pages/Home/components/PostCache.ts b/public/pages/Home/components/PostCache.tsindex 8fc047ad2..c6d3af974 100644--- a/public/pages/Home/components/PostCache.ts+++ b/public/pages/Home/components/PostCache.ts@@ -24,6 +24,10 @@ export const setCachedDescription = (description: string): void => {cache.local.set(CACHE_KEYS.DESCRIPTION, description)}+export const clearCachedDescription = (): void => {+ cache.local.remove(CACHE_KEYS.DESCRIPTION)+}+const getCachedValue = (key: string): string => {return cache.local.get(key) || ""}diff --git a/public/pages/Home/components/ShareFeedback.tsx b/public/pages/Home/components/ShareFeedback.tsxindex c721f12e1..cfe65917d 100644--- a/public/pages/Home/components/ShareFeedback.tsx+++ b/public/pages/Home/components/ShareFeedback.tsx@@ -15,6 +15,7 @@ import CommentEditor from "@fider/components/common/form/CommentEditor"import {CACHE_KEYS,clearCache,+ clearCachedDescription,getCachedDescription,getCachedTags,getCachedTitle,@@ -57,7 +58,7 @@ export const ShareFeedback: React.FC<ShareFeedbackProps> = (props) => {const canEditTags = fider.settings.postWithTags && props.tags.length > 0const descriptionTemplate = fider.session.tenant.descriptionTemplate || ""- const hasCachedDraft = getCachedDescription() !== ""+ const hasCachedDraft = getCachedDescription().trim() !== ""const prefillTemplate = !hasCachedDraft && descriptionTemplate !== ""const [title, setTitle] = useState(getCachedTitle())@@ -143,10 +144,12 @@ export const ShareFeedback: React.FC<ShareFeedbackProps> = (props) => {setTitle(value)setCachedTitle(value)// If this is a manual edit (not auto-generated from description),- // mark the title as manually edited so we stop auto-populating- // If the user clears the title, we still want to allow auto-population+ // mark the title as manually edited so we stop auto-populating.+ // Once the user has touched the title we keep it manually edited even+ // if they clear it, otherwise clearing would re-trigger auto-population+ // from the description.if (isManualEdit) {- setTitleManuallyEdited(value !== "")+ setTitleManuallyEdited(true)}}@@ -162,7 +165,14 @@ export const ShareFeedback: React.FC<ShareFeedbackProps> = (props) => {}const handleDescriptionChange = (value: string) => {- setCachedDescription(value)+ // If the description is emptied (e.g. the prefilled template is deleted),+ // remove it from the cache so reopening the modal prefills the template again+ // instead of restoring an empty draft.+ if (value.trim() === "") {+ clearCachedDescription()+ } else {+ setCachedDescription(value)+ }setDescription(value)}