Open platform to collect and prioritize feedback
User logged out bugs
Matt Roberts541c48179524
diff --git a/public/components/common/form/CommentEditor.tsx b/public/components/common/form/CommentEditor.tsxindex 59df11bfc..ee4471b71 100644--- a/public/components/common/form/CommentEditor.tsx+++ b/public/components/common/form/CommentEditor.tsx@@ -10,6 +10,7 @@ import { UserNames } from "@fider/models"import { actions } from "@fider/services"import "./CommentEditor.scss"+import { useFider } from "@fider/hooks"export type TextType = { text: string }@@ -62,7 +63,6 @@ const Portal = ({ children }: { children?: ReactNode }) => {interface CommentEditorProps {initialValue?: string- disabled?: booleanplaceholder?: stringonChange?: (value: string) => voidonFocus?: React.FocusEventHandler<HTMLDivElement>@@ -92,6 +92,7 @@ export const CommentEditor: React.FunctionComponent<CommentEditorProps> = (propsconst [target, setTarget] = useState<Range | undefined>()const [index, setIndex] = useState(0)const [search, setSearch] = useState("")+ const fider = useFider()// Fetch users when component mountsuseEffect(() => {@@ -101,7 +102,9 @@ export const CommentEditor: React.FunctionComponent<CommentEditorProps> = (propssetUsers(result.data)}}- loadUsers()+ if (fider.session.isAuthenticated) {+ loadUsers()+ }}, [])const renderElement = useCallback((props: RenderElementProps) => <SlateElement {...props} />, [])@@ -190,10 +193,11 @@ export const CommentEditor: React.FunctionComponent<CommentEditorProps> = (props}}><Editable- readOnly={props.disabled}+ readOnly={false}className="slate-editor"renderElement={renderElement}onKeyDown={onKeyDown}+ onFocus={props.onFocus}placeholder={props.placeholder}renderPlaceholder={Placeholder}/>diff --git a/public/pages/ShowPost/components/CommentInput.tsx b/public/pages/ShowPost/components/CommentInput.tsxindex 9c37d7a23..e2fc0fa2a 100644--- a/public/pages/ShowPost/components/CommentInput.tsx+++ b/public/pages/ShowPost/components/CommentInput.tsx@@ -48,6 +48,7 @@ export const CommentInput = (props: CommentInputProps) => {}const editorFocused = () => {+ console.log("focused")if (!fider.session.isAuthenticated) {setIsSignInModalOpen(true)}@@ -76,7 +77,6 @@ export const CommentInput = (props: CommentInputProps) => {initialValue={content}onChange={commentChanged}onFocus={editorFocused}- disabled={!Fider.session.isAuthenticated}placeholder={i18n._("showpost.commentinput.placeholder", { message: "Leave a comment" })}/>{hasContent && (diff --git a/public/services/toastify.tsx b/public/services/toastify.tsxindex ec0e8cb93..4eab273b8 100644--- a/public/services/toastify.tsx+++ b/public/services/toastify.tsx@@ -1,6 +1,6 @@import { I18nProvider } from "@lingui/react"import React from "react"-import ReactDOM from "react-dom"+import ReactDOM from "react-dom/client"import { i18n } from "@lingui/core"import { ToastContainer, toast, ToastContent, ToastOptions } from "react-toastify"@@ -11,15 +11,17 @@ let hasContainer = falseconst setup = () => {if (!hasContainer) {hasContainer = true- ReactDOM.render(- <I18nProvider i18n={i18n}>- <ToastContainer position={toast.POSITION.TOP_RIGHT} />- </I18nProvider>,- document.getElementById("root-toastify")- )+ const rootElement = document.getElementById("root-toastify")+ if (rootElement) {+ const root = ReactDOM.createRoot(rootElement)+ root.render(+ <I18nProvider i18n={i18n}>+ <ToastContainer position={toast.POSITION.TOP_RIGHT} />+ </I18nProvider>+ )+ }}}-export const success = (content: ToastContent, options?: ToastOptions) => {setup()toast.success(content, options)