fix null state

This commit is contained in:
Vikeo
2024-05-27 10:58:42 +02:00
parent 2ec9998a2a
commit 63fbceafe2
2 changed files with 4 additions and 4 deletions

View File

@@ -2,7 +2,7 @@ import { twc } from 'react-twc';
import { useAnalytics } from '../../Hooks/useAnalytics'; import { useAnalytics } from '../../Hooks/useAnalytics';
import { useGlobalSettings } from '../../Hooks/useGlobalSettings'; import { useGlobalSettings } from '../../Hooks/useGlobalSettings';
import { PreStartMode } from '../../Types/Settings'; import { PreStartMode } from '../../Types/Settings';
import { InstallPWA } from '../Misc/InstallPWAButton'; import { InstallPWAButton } from '../Misc/InstallPWAButton';
import { Separator } from '../Misc/Separator'; import { Separator } from '../Misc/Separator';
import { Paragraph } from '../Misc/TextComponents'; import { Paragraph } from '../Misc/TextComponents';
import { ToggleButton } from '../Misc/ToggleButton'; import { ToggleButton } from '../Misc/ToggleButton';
@@ -291,7 +291,7 @@ export const SettingsDialog = ({
</Description> </Description>
</SettingContainer> </SettingContainer>
<div className="flex w-full justify-center"> <div className="flex w-full justify-center">
<InstallPWA /> <InstallPWAButton />
</div> </div>
</> </>
)} )}

View File

@@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react';
import { BeforeInstallPromptEvent } from '../../global'; import { BeforeInstallPromptEvent } from '../../global';
import { useAnalytics } from '../../Hooks/useAnalytics'; import { useAnalytics } from '../../Hooks/useAnalytics';
export const InstallPWA = () => { export const InstallPWAButton = () => {
const supportsPWARef = useRef<boolean>(false); const supportsPWARef = useRef<boolean>(false);
const [promptInstall, setPromptInstall] = const [promptInstall, setPromptInstall] =
useState<BeforeInstallPromptEvent | null>(null); useState<BeforeInstallPromptEvent | null>(null);
@@ -22,7 +22,7 @@ export const InstallPWA = () => {
}, []); }, []);
if (!supportsPWARef.current) { if (!supportsPWARef.current) {
return 'lull'; return null;
} }
return ( return (