cboard
cboard copied to clipboard
New root board is created when change the featured board
This occurs when a user creates a new API communicator, logs in on another device, and changes the featured board. If the new communicator was created in the database without a defaultIncludedBoards
value, that would be an empty array.
At the time of changing the featured board, we do this comprobation:
const defaultBoardsIncluded =
activeCommunicator.defaultBoardsIncluded //here we have a wrong truthy value
|| fallbackInitialDefaultBoardsIncluded(activeCommunicator);
This causes the loss of the current root board on the user communicator
To be able to fix this bug, we need to add an exhaustive comprobation of the defaultIncludedBoards
prop.
Suggestions:
const isValid = (activeCommunicator.defaultBoardsIncluded && activeCommunicator.defaultBoardsIncluded.length > 0) ? true : false;
//or
const isValid = !!(activeCommunicator.defaultBoardsIncluded && activeCommunicator.defaultBoardsIncluded.length);