supabase/realtime-js

Bug when using subscribtions on tables with arrays of jsons

ferdibaum opened this issue · 2 comments

Bug report

Describe the bug

When using subscriptions on tables with arrays of JSONs you get the following console logs

Screenshot 2021-10-23 040809

I think this is because the toArray function in transformers.ts dosn't work properly for arrays of JSONs

@ferdibaum

I think this is because the toArray function in transformers.ts dosn't work properly for arrays of JSONs

export const toArray = (stringValue, type) => { // this takes off the '{' & '}' let stringEnriched = stringValue.slice(1, stringValue.length - 1); // converts the string into an array // if string is empty (meaning the array was empty), an empty array will be immediately returned let stringArray = stringEnriched.length > 0 ? stringEnriched.split(',') : []; let array = stringArray.map((string) => { return convertCell(type, string); }); return array; };

This looks like an older version of the toArray function as the newest version was updated and released yesterday. Can you try version bumping your realtime-js to v1.2.0 or supabase-js to v1.25.0 depending on what you're using?

Yes, that was it. My bad and thanks for the quick answer.