fix: invalidate frame on shell switch

This commit is contained in:
TrèsAbhi committed 2024-08-21 20:04:27 -05:00
1 parent e6b29a4ab8
commit 679bd2956b
2 files changed
+7 -1

No files matched your search

@@ -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;
});
+5 -1
View File
@@ -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]) {