Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check for shape before shape.isLocked #16525

Merged
merged 4 commits into from Jan 24, 2023

Conversation

antobinary
Copy link
Member

What does this PR do?

Tries to avoid a whiteboard component crash logged as isLocked of undefined
Screenshot from 2023-01-20 14-19-09

Closes Issue(s)

Closes # the issue is not reported yet

Motivation

More

Reported via screenshot on 2.6.0-beta.6

Do the shape lock propery set in the container so the props change less times and avoid problems in the useMemo.
@@ -270,7 +270,7 @@ export default function Whiteboard(props) {
}
// set shapes as locked for those who aren't allowed to edit it
Object.entries(shapes).forEach(([shapeId, shape]) => {
if (!shape.isLocked && !hasShapeAccess(shapeId)) {
if (shape &&!shape.isLocked && !hasShapeAccess(shapeId)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (shape &&!shape.isLocked && !hasShapeAccess(shapeId)) {
if (shape && !shape.isLocked && !hasShapeAccess(shapeId)) {

@germanocaumo
Copy link
Collaborator

I think would be better to move this code to the container so we don't need the check and don't change the shapes in the memo, since the shapes are a dependency.
I did a PR against your branch with this change:

antobinary@44692f9

refactor(whiteboard): move shapelock to container + linting
@ramonlsouza ramonlsouza merged commit 41a2b65 into bigbluebutton:v2.6.x-release Jan 24, 2023
@sonarcloud
Copy link

sonarcloud bot commented Jan 24, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

No Coverage information No Coverage information
1.4% 1.4% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants