From 3e328711075653a6dac65a57f4030cfe481f86e3 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 2 Jan 2023 02:08:01 -0800 Subject: [PATCH] Also prevent updating uncap stars on Character/Summon grids --- components/CharacterGrid/index.tsx | 13 ++++++++++--- components/SummonGrid/index.tsx | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/components/CharacterGrid/index.tsx b/components/CharacterGrid/index.tsx index cc76d550..916bc677 100644 --- a/components/CharacterGrid/index.tsx +++ b/components/CharacterGrid/index.tsx @@ -15,6 +15,7 @@ import type { JobSkillObject, SearchableObject } from '~types' import api from '~utils/api' import { appState } from '~utils/appState' +import { accountState } from '~utils/accountState' import './index.scss' @@ -283,10 +284,16 @@ const CharacterGrid = (props: Props) => { position: number, uncapLevel: number ) { - memoizeAction(id, position, uncapLevel) + if ( + party.user && + accountState.account.user && + party.user.id === accountState.account.user.id + ) { + memoizeAction(id, position, uncapLevel) - // Optimistically update UI - updateUncapLevel(position, uncapLevel) + // Optimistically update UI + updateUncapLevel(position, uncapLevel) + } } const memoizeAction = useCallback( diff --git a/components/SummonGrid/index.tsx b/components/SummonGrid/index.tsx index d2092dfb..aba10c33 100644 --- a/components/SummonGrid/index.tsx +++ b/components/SummonGrid/index.tsx @@ -12,6 +12,7 @@ import ExtraSummons from '~components/ExtraSummons' import api from '~utils/api' import { appState } from '~utils/appState' +import { accountState } from '~utils/accountState' import type { SearchableObject } from '~types' import './index.scss' @@ -156,10 +157,16 @@ const SummonGrid = (props: Props) => { position: number, uncapLevel: number ) { - memoizeAction(id, position, uncapLevel) + if ( + party.user && + accountState.account.user && + party.user.id === accountState.account.user.id + ) { + memoizeAction(id, position, uncapLevel) - // Optimistically update UI - updateUncapLevel(position, uncapLevel) + // Optimistically update UI + updateUncapLevel(position, uncapLevel) + } } const memoizeAction = useCallback(