message2opponent works proposals
but does nothing in reality sicne no actual message is being included in request
This commit is contained in:
parent
9c8e296684
commit
cbc78dfcf1
@ -8,13 +8,17 @@ export default function Message2Opponent({ dispatchGames }) {
|
||||
const [value, setValue] = useState('');
|
||||
const syncTimeoutRef = useRef(null);
|
||||
|
||||
if (syncTimeoutRef.current === null) { // <<--- Absorb external value if there is no scheduled sync
|
||||
if (matchPath('/games/new', pathname)) {
|
||||
if (value !== games.newGame.message2opponent)
|
||||
setValue(games.newGame.message2opponent);
|
||||
} else if (value !== '') {
|
||||
setValue('');
|
||||
}
|
||||
if (syncTimeoutRef.current === null) { // <<--- Absorb external value ONLY if there is no scheduled sync
|
||||
var externalValue = '';
|
||||
|
||||
if (matchPath('/games/new', pathname))
|
||||
externalValue = games.newGame.message2opponent;
|
||||
else
|
||||
if (matchPath('/games/proposal', pathname))
|
||||
externalValue = games.proposal.message2opponent;
|
||||
|
||||
if (value !== externalValue)
|
||||
setValue(externalValue);
|
||||
}
|
||||
|
||||
/* --- */
|
||||
@ -23,9 +27,12 @@ export default function Message2Opponent({ dispatchGames }) {
|
||||
syncTimeoutRef.current = null;
|
||||
|
||||
if (matchPath('/games/new', pathname))
|
||||
return dispatchGames({ type: 'nextNewGame', message2opponent });
|
||||
|
||||
console.warn('unknown path');
|
||||
dispatchGames({ type: 'nextNewGame', message2opponent });
|
||||
else
|
||||
if (matchPath('/games/proposal', pathname))
|
||||
dispatchGames({ type: 'nextProposal', message2opponent });
|
||||
else
|
||||
console.warn('unknown path');
|
||||
}
|
||||
|
||||
const update = (value) => {
|
||||
|
@ -12,6 +12,7 @@ const initialState = {
|
||||
|
||||
proposal: {
|
||||
selectedUUID: null,
|
||||
message2opponent: '',
|
||||
},
|
||||
|
||||
// Network
|
||||
|
Loading…
Reference in New Issue
Block a user