Introduce "useAppAction" hook

This commit is contained in:
schroda
2025-05-03 13:24:55 +02:00
parent 3ab70c4802
commit aacdbaaeef
26 changed files with 230 additions and 430 deletions

View File

@@ -25,12 +25,12 @@ import { useNavBarContext } from '@/modules/navigation-bar/contexts/NavbarContex
import { Chapters } from '@/modules/chapter/services/Chapters.ts';
import { GROUPED_VIRTUOSO_Z_INDEX } from '@/modules/core/AppRoute.constants.ts';
import { useAppTitle } from '@/modules/navigation-bar/hooks/useAppTitle.ts';
import { useAppAction } from '@/modules/navigation-bar/hooks/useAppAction.ts';
export const Updates: React.FC = () => {
const { t } = useTranslation();
const { appBarHeight } = useNavBarContext();
const { setAction } = useNavBarContext();
const {
data: chapterUpdateData,
loading: isLoading,
@@ -74,13 +74,7 @@ export const Updates: React.FC = () => {
const lastUpdateTimestamp = lastUpdateTimestampData?.lastUpdateTimestamp.timestamp;
useAppTitle(t('updates.title'));
useLayoutEffect(() => {
setAction(<UpdateChecker />);
return () => {
setAction(null);
};
}, [t, lastUpdateTimestamp]);
useAppAction(<UpdateChecker />);
const loadMore = useCallback(() => {
if (!hasNextPage) {