Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/sso-bypass-allowlist-circular-ref.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
6 changes: 5 additions & 1 deletion packages/clerk-js/src/core/resources/SSOBypassAllowlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import { DeletedObject } from './DeletedObject';
import { SSOBypassAllowlistUser } from './SSOBypassAllowlistUser';

export class SSOBypassAllowlist implements SSOBypassAllowlistResource {
constructor(private readonly organization: { id: string }) {}
declare private readonly organization: { id: string };

constructor(organization: { id: string }) {
Object.defineProperty(this, 'organization', { value: organization, enumerable: false });
}

private get path(): string {
return `/organizations/${this.organization.id}/sso_bypass_allowlist_users`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,5 +484,12 @@ describe('Organization', () => {
expect(result.id).toBe('user_1');
expect(result.deleted).toBe(true);
});

it('does not create a cycle when the organization is serialized', () => {
const organization = createOrganization();

expect(() => JSON.stringify(organization)).not.toThrow();
expect(JSON.parse(JSON.stringify(organization)).ssoBypassAllowlist).toEqual({});
});
});
});
Loading