-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(backend): strip experimental__has from serializable auth object (#…
…2101) * fix(backend): Add experimental__has to properties strip out by makeAuthObjectSerializable * chore(backend): Add test case for makeAuthObjectSerializable * chore(repo): Add changeset
- Loading branch information
Showing
4 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@clerk/backend': patch | ||
--- | ||
|
||
Strip `experimental__has` from the auth object in `makeAuthObjectSerializable()`. This fixes an issue in Next.js where an error is being thrown when this function is passed to a client component as a prop. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type QUnit from 'qunit'; | ||
|
||
import { makeAuthObjectSerializable, signedOutAuthObject } from './authObjects'; | ||
|
||
export default (QUnit: QUnit) => { | ||
const { module, test } = QUnit; | ||
|
||
module('makeAuthObjectSerializable', () => { | ||
test('removes non-serializable props', assert => { | ||
const authObject = signedOutAuthObject(); | ||
const serializableAuthObject = makeAuthObjectSerializable(authObject); | ||
|
||
for (const key in serializableAuthObject) { | ||
assert.notStrictEqual(typeof serializableAuthObject[key], 'function'); | ||
} | ||
}); | ||
}); | ||
}; |
This file contains 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
This file contains 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