Merge pull request #19688 from KDSBrowne/bbb30-multi-draw-crash
fix(whiteboard): Prevent Crash After Viewers Draw Geo Shapes In Multi-User
This commit is contained in:
commit
ac4899e3be
@ -859,10 +859,11 @@ export default Whiteboard = React.memo(function Whiteboard(props) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Object.values(updated).forEach(([_, record]) => {
|
Object.values(updated).forEach(([_, record]) => {
|
||||||
|
const createdBy = prevShapesRef.current[record?.id]?.meta?.createdBy || currentUser?.userId;
|
||||||
const updatedRecord = {
|
const updatedRecord = {
|
||||||
...record,
|
...record,
|
||||||
meta: {
|
meta: {
|
||||||
...prevShapesRef.current[record?.id]?.meta,
|
createdBy,
|
||||||
updatedBy: currentUser?.userId,
|
updatedBy: currentUser?.userId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -970,12 +971,14 @@ export default Whiteboard = React.memo(function Whiteboard(props) {
|
|||||||
|
|
||||||
editor.store.onBeforeChange = (prev, next, source) => {
|
editor.store.onBeforeChange = (prev, next, source) => {
|
||||||
if (next?.typeName === "instance_page_state") {
|
if (next?.typeName === "instance_page_state") {
|
||||||
if (isPresenter || isModerator) return next;
|
|
||||||
|
if ((isPresenter || isModerator)) return next;
|
||||||
|
|
||||||
// Filter selectedShapeIds based on shape owner
|
// Filter selectedShapeIds based on shape owner
|
||||||
if (!isEqual(prev.selectedShapeIds, next.selectedShapeIds)) {
|
if (next.selectedShapeIds.length > 0 && !isEqual(prev.selectedShapeIds, next.selectedShapeIds)) {
|
||||||
next.selectedShapeIds = next.selectedShapeIds.filter(shapeId => {
|
next.selectedShapeIds = next.selectedShapeIds.filter(shapeId => {
|
||||||
const shapeOwner = prevShapesRef.current[shapeId]?.meta?.createdBy;
|
const shapeOwner = prevShapesRef.current[shapeId]?.meta?.createdBy;
|
||||||
return shapeOwner === currentUser?.userId;
|
return !shapeOwner || shapeOwner === currentUser?.userId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user