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

bug: Capacitor 3.1.1 Native-Bridge convert [10,null,null,null] into [10,null,"...","..."] #4824

Closed
jepiqueau opened this issue Jul 12, 2021 · 3 comments

Comments

@jepiqueau
Copy link
Contributor

Bug Report

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 3.1.1
  @capacitor/core: 3.1.1
  @capacitor/android: 3.1.1
  @capacitor/ios: 3.1.1

Installed Dependencies:

  @capacitor/android: 3.1.1
  @capacitor/core: 3.1.1
  @capacitor/cli: 3.1.1
  @capacitor/ios: 3.1.1

[success] Android looking great! 👌

Platform(s)

Android

Current Behavior

An array ie {values:[10, null, null, null] } passed through the bridge with JSArray values = call.getArray("values"); returned values = [10, null, "...", "..."]

Expected Behavior

it should returned : values = [10, null, null, null]

Code Reproduction

An app to reproduce the issue is given https://github.com/jepiqueau/capacitor-sqlite-test.git this is impacting the @capacitor-community/sqlite plugin issue#125 a temporary fix has been provided on the plugin itself.

the Error is coming from the android native-bridge.js file where:

        const safeStringify = (value) => {
            const seen = new Set();
            return JSON.stringify(value, (_k, v) => {
                if (seen.has(v)) {
                    return '...';
                }
                if (typeof v === 'object') {
                    seen.add(v);
                }
                return v;
            });
        };

and could be replaced by as proposed by @chriswep

        const safeStringify = (value) => {
            const seen = new Set();
            return JSON.stringify(value, (_k, v) => {
                if (seen.has(v)) {
                    return '...';
                }
                if (typeof v === 'object'  && v !== null) {
                    seen.add(v);
                }
                return v;
            });
        };

Other Technical Details

npm --version output: 7.6.0

node --version output: v14.15.4

pod --version output (iOS issues only):

Additional Context

see #4798 from @chriswep

@jcesarmobile
Copy link
Member

How is this different from the issue you link?
Please, don't duplicate issues, specially if you know the issue already exists.

@jepiqueau
Copy link
Contributor Author

@jcesaremobile Normally I do not do it but I still see the status need reproduction and I gave a link to a demonstrating app 3 days ago if the status where move to need reply I will not have done it. Sorry for this

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 11, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants