re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
Lu 2021-01-05T01:10:19.166600Z

I was wondering what happens if one subscribes from within a callback function i.e. on-click? Are any of the four subscription layers compromised at all?

Lu 2021-01-05T09:46:30.169700Z

I guess I don’t get the “it might not be freed”. It seems the mem leak happens by chance not for sure

p-himik 2021-01-05T09:54:06.170Z

If the sub is also used in a view, then it will be freed when the view is unmounted. If the sub is not used in any view, there will be a leak.

Lu 2021-01-05T11:08:52.170400Z

Great! Thanks.

p-himik 2021-01-05T03:58:20.166800Z

It's somewhere in the FAQ I believe. It will create a leak since the subs will be cached but will never be pruned.

p-himik 2021-01-05T04:43:43.167Z

My bad - not yet: https://github.com/day8/re-frame/pull/565

2021-01-05T06:40:27.167500Z

@lucio The subscribe and the subsequent dereference should happen in the render phase. Not much later when an on-click handler is called.

👍 1