From 679bd2956baf5b91bae8c1ed8401da3819712dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Wed, 21 Aug 2024 20:04:27 -0500 Subject: [PATCH] fix: invalidate frame on shell switch --- .../tankopedia/[id]/components/Model/components/Options.tsx | 2 ++ src/app/tools/tankopedia/[id]/page.tsx | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/tools/tankopedia/[id]/components/Model/components/Options.tsx b/src/app/tools/tankopedia/[id]/components/Model/components/Options.tsx index 0cda66b87..7773cf731 100644 --- a/src/app/tools/tankopedia/[id]/components/Model/components/Options.tsx +++ b/src/app/tools/tankopedia/[id]/components/Model/components/Options.tsx @@ -17,6 +17,7 @@ import { Tabs, Text, } from '@radix-ui/themes'; +import { invalidate } from '@react-three/fiber'; import { useEffect, useState } from 'react'; import { ModuleButton } from '../../../../../../../components/ModuleButtons/ModuleButton'; import { SmallTankIcon } from '../../../../../../../components/SmallTankIcon'; @@ -216,6 +217,7 @@ export function Options({ thicknessRange }: OptionsProps) { marginTop: shellIndex === 0 ? 0 : -1, }} onClick={() => { + invalidate(); mutateDuel((draft) => { draft.antagonist.shell = thisShell; }); diff --git a/src/app/tools/tankopedia/[id]/page.tsx b/src/app/tools/tankopedia/[id]/page.tsx index b221b086c..dbf1911fa 100644 --- a/src/app/tools/tankopedia/[id]/page.tsx +++ b/src/app/tools/tankopedia/[id]/page.tsx @@ -1,5 +1,6 @@ 'use client'; +import { invalidate } from '@react-three/fiber'; import { useEffect } from 'react'; import { AdMidSectionResponsive } from '../../../../components/AdMidSectionResponsive'; import PageWrapper from '../../../../components/PageWrapper'; @@ -8,9 +9,9 @@ import * as Duel from '../../../../stores/duel'; import * as TankopediaEphemeral from '../../../../stores/tankopediaEphemeral'; import { HistorySection } from './components/HistorySection'; import { CharacteristicsSection } from './components/Model/CharacteristicsSection'; -import { MetaSection } from './components/Model/MetaSection'; import { GameModeSection } from './components/Model/GameModeSection'; import { HeroSection } from './components/Model/HeroSection'; +import { MetaSection } from './components/Model/MetaSection'; import { TechTreeSection } from './components/Model/TechTreeSection'; import { ShotDisplaySection } from './components/ShotDisplaySection'; import { TestingSection } from './components/TestingSection'; @@ -34,11 +35,13 @@ export default function Page({ params }: { params: { id: string } }) { } if (event.key === '1') { + invalidate(); wipeShot(); mutateDuel((draft) => { draft.antagonist.shell = draft.antagonist.gun.shells[0]; }); } else if (event.key === '2') { + invalidate(); wipeShot(); mutateDuel((draft) => { if (draft.antagonist.gun.shells[1]) { @@ -46,6 +49,7 @@ export default function Page({ params }: { params: { id: string } }) { } }); } else if (event.key === '3') { + invalidate(); wipeShot(); mutateDuel((draft) => { if (draft.antagonist.gun.shells[2]) {