Skip to content
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

Type issue: objectForPrimaryKey still returns undefined but not null #6045

Closed
Yupeng-li opened this issue Aug 8, 2023 · 1 comment
Closed

Comments

@Yupeng-li
Copy link

Yupeng-li commented Aug 8, 2023

How frequently does the bug occur?

Always

Description

The changelog of v11.0.0 says this:

When no object is found calling Realm#objectForPrimaryKey, null is returned instead of undefined

But these two are not updated to line up with the document above. They still return undefined instead of null

objectForPrimaryKey<T extends Realm.Object>(type: {new(...arg: any[]): T; }, key: Realm.PrimaryKey): T | undefined;

objectForPrimaryKey<T>(type: string | {new(...arg: any[]): T; }, key: Realm.PrimaryKey): (T & Realm.Object<T>) | undefined;

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

11.9

What services are you using?

Local Database only

Are you using encryption?

Yes

Platform OS and version(s)

All

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

@kneth
Copy link
Contributor

kneth commented Aug 8, 2023

It has been fixed in v12: https://github.com/realm/realm-js/blob/main/packages/realm/src/Realm.ts#L946-L984

You are welcome to try the latest release candidate (npm install realm@next).

@sync-by-unito sync-by-unito bot closed this as completed Aug 8, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants