Skip to content

fix(note-widget): reinitialize markdown editor after async note load and workflow remount - #51

Open
prolps wants to merge 1 commit into
FreeterApp:masterfrom
prolps:fix/note-widget-markdown-remount
Open

prolps wants to merge 1 commit into
FreeterApp:masterfrom
prolps:fix/note-widget-markdown-remount

Conversation

@prolps

@prolps prolps commented Sep 1, 2026

Copy link
Copy Markdown

Summary

Fixes an issue where Markdown notes revert to plain text / raw textarea without formatting when switching workflows, changing projects, or remounting widgets after Memory Saver unmounts them.

Cause

In src/renderer/widgets/note/widget.tsx, the useEffect hook responsible for initializing TinyMDE only ran on initial mount when isLoaded was false (at which point textAreaRef.current was null).

Because isLoaded was missing from the hook's dependency array, the effect was never re-triggered once dataStorage.getText() resolved and the <textarea> actually rendered into the DOM. Consequently, the Markdown visual editor failed to attach upon subsequent workflow re-renders.

Solution

  1. Added isLoaded to the editor's useEffect dependency array so TinyMDE initializes immediately after the textarea DOM node is mounted.
  2. Added an idempotent cleanup routine (removeExistingEditorDOM) to prevent duplicate DOM nodes or memory leaks during component unmount/remount cycles.
  3. Explicitly typed the change event handler to comply with strict TypeScript/ESLint rules.

How to Test

  1. Create a Note Widget and enable Markdown in the widget settings.
  2. Add formatted Markdown text (headers, bold, checkboxes, lists).
  3. Switch to another Workflow or Project, then switch back.
  4. Verify that the formatted Markdown view renders immediately without falling back to the raw <textarea>.

c4rn4l pushed a commit to c4rn4l/FreeterN that referenced this pull request Nov 4, 2026
- 손상된 영구 상태(app/window) 검증 후 기본값으로 안전 폴백 (CHANGES FreeterApp#49)
- 새 위젯: D-Day — 멀티 디데이(라벨+날짜) + 날짜/요일 표시 토글 (CHANGES FreeterApp#51)
- 위젯 카운트 표시: To-Do 완료/전체, Note 단어/글자 수 (CHANGES FreeterApp#50)
- Top Bar 팝업 창 경계 클램프 + 리사이저 드래그 리스너 누수 정리 (CHANGES FreeterApp#48 후속)
- perf: workflowSwitcher copiedWorkflows 메모이제이션 (불필요 재계산 제거)
- test: useElementRect 단언을 toHaveTextContent로 정리
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant