Open tmthn opened 2 years ago
Issue is fixed. We used a different approach for updating the session based on your package. Closing this now.
@tmthn how did you manage to sort this out in your project?
As far as I can tell, this occurs because Phoenix.LiveView.connected?/1
returns false
when invoked inside mount/3
callback in my project: https://github.com/pentacent/phoenix_live_session/blob/56c0719e7d97a313d8fe859e3dd80af3ba4154f1/lib/phoenix_live_session.ex#L229.
This results in the library not putting in the :live_session
key to socket.private
, and that's what's missing when we call put_session/3
.
We implemented our own custom session store because i could not dig deeper into this problem due to deadlines with this project. We use similar to the librarys approach an ETS table to store the user tokens and sweep them as they expire. Unfortunately we do not use the PubSub solution used here. To ensure access on both levels (http request and socket connection) we run the ensure access function in both calls. In our custom solution we encountered a similar problem as described here beacuse of the double evaluation of the mount callback. I don't really understand what is causing this problem.
Same issue.
Oops, seems like my issue was not calling maybe_subscribe
.
I try to update some data within the session when a certain constellation has occurred. As soon as I use the function PhoenixLiveSession.put_session I get the following error:
My mount looks like this:
And i am using the handle info callback as described:
My put session assigns function looks like this:
Am i doing something wrong?