mirror of
https://github.com/hoornet/vega.git
synced 2026-05-08 13:19:10 -07:00
Fix thread disappearing bug, improve article editor UX
Move selectedNote guard after hooks in ThreadView to fix React rules of hooks violation that caused thread content to blank out. Article editor gets inline image previews, readable toolbar labels, and drag-and-drop image support. Thread reply textareas now auto-expand.
This commit is contained in:
@@ -16,8 +16,6 @@ export function ThreadView() {
|
||||
const { selectedNote, goBack } = useUIStore();
|
||||
const { loggedIn } = useUserStore();
|
||||
const { mutedPubkeys, contentMatchesMutedKeyword } = useMuteStore();
|
||||
if (!selectedNote) { goBack(); return null; }
|
||||
const focusedEvent = selectedNote;
|
||||
|
||||
const [rootEvent, setRootEvent] = useState<NDKEvent | null>(null);
|
||||
const [ancestors, setAncestors] = useState<NDKEvent[]>([]);
|
||||
@@ -32,9 +30,12 @@ export function ThreadView() {
|
||||
const autoResize = useAutoResize(2, 8);
|
||||
const replyRef = useRef<HTMLTextAreaElement>(null);
|
||||
const scrollRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const [retryCount, setRetryCount] = useState(0);
|
||||
|
||||
// Guard AFTER all hooks to satisfy React rules of hooks
|
||||
if (!selectedNote) { goBack(); return null; }
|
||||
const focusedEvent = selectedNote;
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user