From 27f2d0eca517ddb980498e79e3701742705d0e5d Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 6 Mar 2025 13:38:59 +0800 Subject: [PATCH] Small fixes for 'Add to Thread' submenu --- src/components/compose-button.jsx | 44 +++++++++++++------------------ src/locales/en.po | 21 ++++++--------- 2 files changed, 27 insertions(+), 38 deletions(-) diff --git a/src/components/compose-button.jsx b/src/components/compose-button.jsx index 583f0742..23233215 100644 --- a/src/components/compose-button.jsx +++ b/src/components/compose-button.jsx @@ -1,6 +1,6 @@ import { Trans, useLingui } from '@lingui/react/macro'; import { ControlledMenu, MenuDivider, MenuItem } from '@szhsin/react-menu'; -import { useCallback, useRef, useState } from 'preact/hooks'; +import { useCallback, useEffect, useRef, useState } from 'preact/hooks'; import { useHotkeys } from 'react-hotkeys-hook'; import { useLongPress } from 'use-long-press'; import { useSnapshot } from 'valtio'; @@ -17,6 +17,7 @@ import statusPeek from '../utils/status-peek'; import { getCurrentAccountID } from '../utils/store-utils'; import Icon from './icon'; +import Loader from './loader'; import MenuLink from './menu-link'; import RelativeTime from './relative-time'; import SubMenu2 from './submenu2'; @@ -109,6 +110,12 @@ export default function ComposeButton() { setMenuOpen(false); }, []); + useEffect(() => { + if (menuOpen) { + fetchLatestPosts(); + } + }, [fetchLatestPosts, menuOpen]); + return ( <>