Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 23, 2025

New Pull Request Checklist

Issue Description

Adding a role to an ACL record throws TypeError: Cannot read properties of undefined (reading 'set') in version 8.0+, working in 7.5.

Approach

Race condition: entryTypes state initialized as undefined, set to Map in async componentDidMount. Fast user interactions trigger .set() calls before initialization completes.

Changes:

  • PermissionsDialog.react.js: Initialize entryTypes: new Map() instead of undefined
  • ProtectedFieldsDialog.react.js: Same fix for protected fields dialog
// Before
this.state = {
  entryTypes: undefined,  // Later set in async componentDidMount
  // ...
};

// After
this.state = {
  entryTypes: new Map(),  // Ready immediately
  // ...
};

Note: This PR specifically fixes the race condition causing the reported "Cannot read properties of undefined (reading 'set')" error. A separate potential issue exists where validateEntry returns role entries without the "role:" prefix when roles are not found, which would cause a different error ("TypeError: next.role.getName is not a function"). That is a distinct bug not addressed in this PR.

TODOs before merging

  • Add tests
  • Add changes to documentation (guides, repository pages, in-code descriptions)
Original prompt

This section details on the original issue you should resolve

<issue_title>link role to an ACL record</issue_title>
<issue_description>

Issue Description

I cannot link a role to an ACL record; this error has been present since version 8 and does not occur in version 7.5.

Steps to reproduce

Go to any record and try to link a role to the ACL

Environment

8.0

Dashboard

  • Parse Dashboard version: 8 onwards
  • Browser (Safari, Chrome, Firefox, Edge, etc.): Chrome
  • Browser version: 143

Server

  • Parse Server version: 9.1.1
  • Operating system: Windows and MacOS
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local

Database

  • System (MongoDB or Postgres): MongoDB
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Atlas

Logs

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'set')
at dashboard.bundle.js:2:3049702
</issue_description>

<agent_instructions>Implement the suggested fix option 1.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link

coderabbitai bot commented Dec 23, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

@parseplatformorg
Copy link
Contributor

parseplatformorg commented Dec 23, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI and others added 2 commits December 23, 2025 19:20
Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix linking role to an ACL record error Fix race condition causing role linking to ACL to fail Dec 23, 2025
Copilot AI requested a review from mtrezza December 23, 2025 19:24
@mtrezza mtrezza changed the title Fix race condition causing role linking to ACL to fail fix: Role linking to ACL fails with TypeError Dec 23, 2025
@parse-github-assistant
Copy link

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

@mtrezza mtrezza marked this pull request as ready for review December 23, 2025 19:26
@mtrezza
Copy link
Member

mtrezza commented Dec 23, 2025

@copilot read the Coding Plan in #3093. In your analysis for this PR you identified a race condition as the root cause, but coderabbitai's analysis in the Coding Plan is a missing prefix. Which one is true?

Copy link
Contributor Author

Copilot AI commented Dec 23, 2025

@copilot read the Coding Plan in #3093. In your analysis for this PR you identified a race condition as the root cause, but coderabbitai's anal...

Both analyses identify real issues, but they cause different errors:

My race condition fix (commits 2a8d09a, 99ba2fa):

  • Error: Cannot read properties of undefined (reading 'set') ✅ Matches the reported error
  • Cause: entryTypes undefined before componentDidMount completes, fails at line 797 when calling .set()
  • Fix: Initialize entryTypes: new Map() in constructor

Missing prefix issue (coderabbitai's analysis):

  • Error: Would be TypeError: next.role.getName is not a function
  • Cause: When a role with "role:" prefix is not found, validateEntry returns entry without prefix (just "TestRole" string instead of role object)
  • Would fail at line 747: next.role.getName() on a string
  • This is a DIFFERENT bug not reported in this issue

The reported error message specifically mentions "reading 'set'" which matches the race condition, not the prefix issue. However, the prefix bug exists and could cause problems in other scenarios.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/parse-community/parse-dashboard/issues/3093
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@mtrezza
Copy link
Member

mtrezza commented Dec 23, 2025

@lstarkgv could you please try out this PR and see whether is solves the issue?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

link role to an ACL record

3 participants