DB updates not persisting only when client viewing certain pages in app

Hi Guys,

Just thought I’d let you know I managed to get to the root of the issue. And of course it was an issue with my code - not a bug! :slight_smile:

I installed meteor-ddp-analyzer (which I hadn’t come across before and is absolutely incredible for seeing what’s actually going on under the hood) - and that showed that I had a react component lifecycle method running unexpectedly, which in turn was making a separate Method call to the server, which effectively overwrote my change! Stupid of me not to spot it to be fair.

Ultimately this came down to me leaning on React state for optimistic UI and then doing a call to update the backend. I realise now that all the fudges you have to put in place to make that work just introduces these sorts of side effects too easily, and I’m much better off relying on Minimongo client updates as there probably just as fast (negligible) and give me the single source of truth.

Lesson learned.

Thanks for your help guys

1 Like