Fix: prevent null account_id when creating identity from Accounts UI#6579
Open
HussainAther wants to merge 2 commits into
Open
Fix: prevent null account_id when creating identity from Accounts UI#6579HussainAther wants to merge 2 commits into
HussainAther wants to merge 2 commits into
Conversation
DougReeder
requested changes
May 4, 2026
DougReeder
left a comment
Member
There was a problem hiding this comment.
Also, the directions for reproducing the issue don't appear to be complete
| <a href={`#/identities/create?account_id=${record.id}`} className={classes.fieldLink}> | ||
| Create Identity | ||
| </a> | ||
| ) : ( |
Member
There was a problem hiding this comment.
This is not syntactically correct JavaScript
Author
There was a problem hiding this comment.
ty. Fixed the JSX syntax issue and simplified the guard for missing record.id.
Also updated the test steps for clearer reproduction.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Fixes an issue where the "Create Identity" link in the Accounts admin UI could generate a URL with a missing or invalid
account_id.Adds a guard in
IdentityCreateLinkto ensure thatrecord.idexists before constructing the link. If the ID is missing, the link is rendered in a disabled state instead of producing an invalid URL.Why?
In the current implementation, the link:
can be generated even when
record.idisnullorundefined.This results in:
account_id=nullorundefined)/accounts?id=eq.null)This PR prevents those invalid states and improves robustness of the Accounts -> Identity workflow.
Fixes #6573
Examples
Before:
After:
If
record.idexists -> normal behaviorIf missing -> link is disabled and no invalid navigation occurs
How to test
Run the admin UI locally:
npm run local
Navigate to the Accounts admin page
Open browser dev tools (Console)
Temporarily modify the link by simulating a missing record id:
#/identities/create?account_id=
Click the link
Before this fix:
/accounts?id=eq.null)After this fix:
Documentation of functionality
No documentation of changes required. This is a UI robustness fix.
Limitations
record.idat the UI level onlyrecord.id(if any exist)Alternative implementations considered
Allowing navigation but handling null account_id downstream
Open questions
None
Additional details or related context
*This change improves resilience of admin workflows involving identity creation
Parts of this change were developed with the assistance of an AI tool (ChatGPT), particularly for debugging guidance and refining the implementation. The final code and testing were reviewed and validated manually.