Also prevent updating uncap stars on Character/Summon grids

This commit is contained in:
Justin Edmund 2023-01-02 02:08:01 -08:00
parent d3c2c6846b
commit 3e32871107
2 changed files with 20 additions and 6 deletions

View file

@ -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(

View file

@ -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(