Merge pull request #15853 from GuiLeme/fix-issue-15843

(fix) - Fix current not being persisted
This commit is contained in:
Ramón Souza 2022-10-17 13:37:13 -03:00 committed by GitHub
commit cb887f4087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -330,18 +330,17 @@ class PresentationUploader extends Component {
let shouldUpdateState = isOpen && !prevProps.isOpen;
const presState = Object.values({
...propPresentations,
...presentations,
...JSON.parse(JSON.stringify(propPresentations)),
...JSON.parse(JSON.stringify(presentations)),
});
if (propPresentations.length > prevPropPresentations.length) {
shouldUpdateState = true;
const propsDiffs = propPresentations.filter(p => !prevPropPresentations.includes(p))
const propsDiffs = propPresentations.filter(p =>
!prevPropPresentations.some(presentation => p.id === presentation.id
|| p.temporaryPresentationId === presentation.temporaryPresentationId));
propsDiffs.forEach(p => {
const index = presState.findIndex(pres => {
if (p.isCurrent) {
pres.isCurrent = false;
}
return pres.temporaryPresentationId === p.temporaryPresentationId || pres.id === p.id;
});
if (index === -1) {