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

Device-Sync clientRest mode typescript error #6316

Closed
maichongju opened this issue Dec 12, 2023 · 3 comments
Closed

Device-Sync clientRest mode typescript error #6316

maichongju opened this issue Dec 12, 2023 · 3 comments

Comments

@maichongju
Copy link

maichongju commented Dec 12, 2023

How frequently does the bug occur?

Always

Description

When setting the clientRest mode on react native with typescript. Typescript will report that the value is not assignable to type ClientResetMode.

The code still works, but it is a bug that should be fixed with the typing issue.

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

Add the following code in the app.

<RealmProvider
  schema={[FriendRequest]}
  sync={{
    flexible: true,
    clientReset:{
      mode: 'manual', // <-- Here the type error show up
      onManual: (session, path) => {
        // handle manual client reset here
      },
    },
    onError: (session, error) => {
      logger.error(`Realm sync error: ${error}`);
    }
  }}

>
  // Rest of the code
</RealmProvider>

Version

"realm": "^12.3.1",, "@realm/react": "^0.6.2",

What services are you using?

Atlas Device Sync

Are you using encryption?

No

Platform OS and version(s)

Win11 23H2

Build environment

No response

Cocoapods version

No response

@elle-j
Copy link
Contributor

elle-j commented Dec 13, 2023

Hi @maichongju, you can import { ClientResetMode } from "realm" and use that enum for setting the mode.

@maichongju
Copy link
Author

Yes. I believe I got misled by the documentation from here and here. As you can see it is telling us to use the string "manual" for the mode. But now I look at other code blocks, they did use the ClientRestMode.

Is there any chance you know how to report this kind of documentation inconsistency?

@elle-j
Copy link
Contributor

elle-j commented Dec 14, 2023

Thanks for bringing it to our attention anyway! I'll let our Docs team know 👍

Atlas Device SDK (Realm) docs repo is here: https://github.com/mongodb/docs-realm

@sync-by-unito sync-by-unito bot closed this as completed Dec 14, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 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