realm/realm-flipper-plugin

Error: Flipper: Expected serializable (undefined, an array or an object). Got: null

fendorio opened this issue · 2 comments

With the latest version of realm-flipper-device-plugin, one of the changes in the latest commit (b1a2fdc) is causing an issue with the react-native-flipper package.

On line 40 of the RealmPlugin.tsx file, this latest commit adds a null as the second parameter to the connection.send function, i.e. changing it from this

connection.send("getCurrentQuery");

To this

connection.send("getCurrentQuery", null);

This causes an error to be thrown by the react-native-flipper package, all data passed to the "send" function is validated using the following function.

function assertSerializable(data) {
  if (
    data === undefined ||
    Array.isArray(data) ||
    (data && typeof data === 'object')
  ) {
    return true;
  }
  console.log("FLIPPER Data", data);
  throw new Error(
    'Flipper: Expected serializable (undefined, an array or an object). Got: ' +
      data,
  );
}

The newly passed null is causing the react-native-flipper package to throw an error, as null is not does not pass the checks in the function above.

For me, this causes me to be unable to use this plugin with Flipper, I'm using patch-package to circumvent this with a patch that removes the newly added null.

So my question is, why was the null added, and what purpose does it serve?

I'm using the following software versions

Flipper Version 0.176.1 (50.0.0)
react-native-flipper 0.176.1
realm-flipper-plugin-device 1.0.27

Screenshot with patch removing the null

Screenshot 2022-12-29 at 01 58 33-min

Screenshot using the current version of this package (unpatched)

Screenshot 2022-12-29 at 02 00 33-min

gagik commented

Hey!
Thanks for the detailed report, I believe the discrepancy between the null and the undefined being checked was unintentional. Could you try the latest release of the realm-flipper-plugin-device? It should work without the patch now.

Hey - Thanks for the swift response, I can confirm upgrading to the new version resolves this issue without the patch, many thanks.