Fork me on GitHub
#cljsrn
<
2019-10-23
>
Maksym12:10:50

@vikeri this event runs only when component is mounted, in my case it's not going to work, I open new component after my component rendered, than I go back by "back button", so my component stays on stack and nah, does not even want to update 😕

vikeri12:10:19

@titov Sorry meant :componentDidUpdate

Maksym12:10:19

@vikeri how can force this event to run?

vikeri12:10:57

It will run every time the component is updated

vikeri12:10:24

How do you mean force?

Maksym12:10:37

My situation is next: I use ReactNavigationStack to navigate between views in my app. When I open first view, I fetch data from server, than with a button on the firrst view, I open second view, do my stuff and go back with back button in a header of the view, and I see first view again. Now I want to fetch data from server again to get updates

vikeri12:10:26

Probably better to observe the navigation state then, and depending on which route you’re on dispatch new http calls

Maksym12:10:52

Nah I was afraid you will propose this 😄

vikeri12:10:22

Since the views are cached in React Navigation I think it’s the only way to do it reliably

Maksym12:10:32

Ok, I'll try, thanks. Btw do you know why reagent does not update rendered dynamic data sometimes? I have a view on which I display a list, this list is computed from subscribed data, and I change this data with response from server.

vikeri13:10:07

@titov In my experience reagent always updates the data. But then I also use re-frame 99% of the time. I can recommend re-frame if you haven’t looked at it

Maksym13:10:56

I use re-frame 😞

vikeri13:10:29

Ok, well then I’ve never had that issue. Are you sure you’re updating the data correctly?

Maksym13:10:52

I hope so cause in other place almost same code does work.

Maksym13:10:07

@vikeri take a look at my code: https://codeshare.io/alg6vj

vikeri13:10:06

I would place load-warehouse and load-item-names in a handler and get the :car-key from the db directly. Try to run everything via handlers and subscribers