marmelab / ra-supabase

Supabase adapter for react-admin, the frontend framework for building admin applications on top of REST/GraphQL services.
MIT License
142 stars 26 forks source link

Running examples broken with `Array(1200)` for `generateContactNotes` #53

Open AntonOfTheWoods opened 3 months ago

AntonOfTheWoods commented 3 months ago

I had to reduce to Array(500) or

    console.log('Updating contacts status...');
    await Promise.all(
        persistedContactNotes
            .sort(
                (a, b) =>
                    new Date(a.date).valueOf() - new Date(b.date).valueOf()
            )
            .map(note => {
                return supabase.from('contacts').update({
                    ...persistedContacts.find(
                        contact => contact.id === note.contact_id
                    ),
                    status: note.status,
                });
            })
    );

Causes errors that breaks the subsequent calls to supabase. Initially it appeared (from the supabase help) that it should be update().eq(...) rather than simply update(), but even with other fixes I wasn't able to get Array(1200) to work. Interestingly, it appears that it isn't stable working at Array(500) either, though it appears to mostly work.

Maybe it's something invalid that gets generated and over about 500 the chance of the invalid entry getting generated goes above a threshold?

AntonOfTheWoods commented 3 months ago

Though it obviously might be related, I am also getting errors after logging in, and many broken screens:

GET http://localhost:54321/rest/v1/sales?select=id%2Cfirst_name%2Clast_name&email=ilike.anton%40melser.org 406 (Not Acceptable)
console.js:213  Error
    at getIdentity (authProvider.ts:13:19)
    at async Object.getIdentity (authProvider.ts:164:34)

The contacts, companies and deals all fail with 4x the first error, then 1x the final error in the browser console