-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: Role linking in ACL fails with type error #3095
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
Conversation
📝 WalkthroughWalkthroughThe changes fix Parse API usage by removing unnecessary Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
|
🚀 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. |
Both analyses identify real issues, but they cause different errors: My race condition fix (commits 2a8d09a, 99ba2fa):
Missing prefix issue (coderabbitai's analysis):
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:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@lstarkgv could you please try out this PR and see whether is solves the issue? |
Sure, I’ll try out the PR and let you know if it solves the issue. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/dashboard/Data/Browser/SecurityDialog.react.js (1)
31-33:⚠️ Potential issue | 🟡 MinorPre-existing bug:
toLowerCase()comparison will never match'requiresAuthentication'.
text.toLowerCase()produces all-lowercase output, so it can never equal the mixed-case string'requiresAuthentication'. This condition is unreachable. The fix would be to compare against the lowercase form or drop thetoLowerCase()call:Proposed fix
- if (text.toLowerCase() === 'requiresAuthentication') { + if (text.toLowerCase() === 'requiresauthentication') {This is pre-existing and outside the scope of this PR, but worth tracking.
🧹 Nitpick comments (1)
src/components/PermissionsDialog/PermissionsDialog.react.js (1)
615-658: Good use ofPromise.allSettledwith graceful handling of partial failures.The switch from
Promise.alltoPromise.allSettledensures that one invalid/deleted entry doesn't prevent all other entries from rendering their type pills. The functionalsetStatewithmergecorrectly preserves any entries that the user may have added while the async validation was in flight.One minor note: if
result.valuehas atypethat doesn't match any of theifconditions (lines 631–652),keyremainsundefinedandentryTypes.set(undefined, value)would silently add a junk entry.Suggested guard
} else if (type === 'pointer') { key = entry; value[type] = true; } - entryTypes = entryTypes.set(key, value); + if (key !== undefined) { + entryTypes = entryTypes.set(key, value); + } }
# [8.5.0-alpha.4](8.5.0-alpha.3...8.5.0-alpha.4) (2026-02-07) ### Bug Fixes * Role linking in ACL fails with type error ([#3095](#3095)) ([2070d29](2070d29))
|
🎉 This change has been released in version 8.5.0-alpha.4 |
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:
entryTypesstate initialized asundefined, set toMapin asynccomponentDidMount. Fast user interactions trigger.set()calls before initialization completes.Changes:
PermissionsDialog.react.js: InitializeentryTypes: new Map()instead ofundefinedProtectedFieldsDialog.react.js: Same fix for protected fields dialogNote: 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
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Summary by CodeRabbit
Bug Fixes
Refactor