Page 1 of 1

[REACT] Immer problem (redux) with Scheduler Pro

Posted: Mon Jan 30, 2023 6:15 pm
by burnit

Hi,

i have to create a new thread, sorry.

Please take your react + redux example and add this code under the transformResponse part in the data.js file.

    async onCacheEntryAdded(arg, { updateCachedData, cacheDataLoaded, cacheEntryRemoved }) {
                try {
                    // wait for the initial query to resolve before proceeding
                    await cacheDataLoaded;
        
// when data is received from the socket connection to the server, // if it is a message and for the appropriate channel, // update our query result with the received message const newData = /* import here youre new dataset */ setTimeout(() => { updateCachedData((draft) => { return [newData]; }, 5000); }); } catch (e) { console.log(e); // no-op in case `cacheEntryRemoved` resolves before `cacheDataLoaded`, // in which case `cacheDataLoaded` will throw } // cacheEntryRemoved will resolve when the cache subscription is no longer active await cacheEntryRemoved; // perform cleanup steps once the `cacheEntryRemoved` promise resolves },

You should get following error message: Uncaught TypeError: Cannot add property expanded, object is not extensible

Can you reproduce it?


Re: [REACT] Immer problem (redux) with Scheduler Pro

Posted: Mon Jan 30, 2023 9:18 pm
by marcio

Hey burnit,

I added that to the last version demo and the query didn't trigger any error (check the screenshot).

Which version are you using?


Re: [REACT] Immer problem (redux) with Scheduler Pro

Posted: Tue Jan 31, 2023 12:00 am
by burnit

Hi Márcio,

can you please send me your test demo?

I would like to test it on our side.

We are currently using version 5.2.3

Greetings André


Re: [REACT] Immer problem (redux) with Scheduler Pro

Posted: Tue Jan 31, 2023 3:15 pm
by marcio

Hey André,

I'm sharing the advanced demo code, but you also have the source code of that one in the SchedulerPro package.