Skip to content

Commit

Permalink
feat(smartAvatar): ACT-759 add try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri-wolf3d committed Aug 2, 2024
1 parent 5783fa8 commit 084784c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/hooks/useDeviceDetector/use-device-detector.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,17 @@ export function useDeviceDetector(options?: DeviceDetectorHookProps) {

useEffect(() => {
const fetchDeviceDetector = async () => {
const gpuTierResult = await getGPUTier();
let gpuTierResult: TierResult = { type: 'BENCHMARK', tier: 3 };

if (gpuTierResult.type !== 'BENCHMARK') {
gpuTierResult.tier = 3;
try {
gpuTierResult = await getGPUTier();

// Safari fails to detect the GPU tier, so we set it to the highest tier
if (gpuTierResult.type !== 'BENCHMARK') {
gpuTierResult.tier = 3;
}
} catch (error) {
console.error(error);

Check warning on line 60 in src/hooks/useDeviceDetector/use-device-detector.hook.ts

View workflow job for this annotation

GitHub Actions / Linting

Unexpected console statement
}

setDeviceDetector(new DeviceDetectorService({ gpuTierResult, ...options }));
Expand Down

0 comments on commit 084784c

Please sign in to comment.