Fork me on GitHub
#membrane
<
2021-02-22
>
jlmr08:02:42

@smith.adriane thanks for the reply. As I said its just an experiment for now, and I can see advantages (and disadvantages) to all the approaches you mention. Is there some mechanism in membrane to assist with: > put all state in a db, all effects update the db and the ui queries the db (with caching) when it needs to re-render. Where would I “hook into” the re-render process to trigger db queries?

phronmophobic08:02:19

I just uploaded a proof of concept I made previously that integrates with datascript, https://github.com/phronmophobic/membrane-datascript

phronmophobic08:02:39

it's a little messy since it's a just a proof of concept

phronmophobic08:02:17

every backend's run function accepts a 0 arity function that should return a view when called. (for a more in-depth explanation see https://blog.phronemophobic.com/ui-model.html)

phronmophobic08:02:41

this is the UI's view-function as mentioned in the design blog posts

phronmophobic08:02:22

the view function will be called whenever it's time to rerender

phronmophobic08:02:55

really, the short answer is that membrane doesn't have a framework that packages everything

phronmophobic08:02:56

One of the problems membrane tries to address is that UI code tends to absorb the rest of your application. You end up with react-http, react-db, react-async, etc. Membrane tries to build user interfaces out of simpler pieces so that you don't need membrane specific libraries for non ui related code. If you need caching, you just use a caching library. If you need http, just use any http library.

phronmophobic09:02:29

not sure if any of that makes sense

jlmr09:02:38

Meaning the view function you provide should somehow incorporate the necessary queries, caching, etc. I guess that makes sense!

👍 3
jlmr09:02:47

Am I right when this means I should not rely on the component/make-app function that membrane provides? Because that function has its own take on state management

👍 3
jlmr09:02:36

Great, then I’m slowly getting there 🙂

phronmophobic09:02:48

you're doing great. I realize there's a pretty steep learning curve. Thanks for giving it a try 😄

🙌 3
phronmophobic09:02:59

It's pretty late here, so I'm going to have to head out. Hopefully, the example helps!

jlmr09:02:40

I’m sure it will, but will look at it later tonight. Thanks for all the help!

jlmr19:02:23

@smith.adriane sending this now so it will be there when you’re day starts again (I think we are in very different timezones). 🙂 Does the event-loop in run also execute the view function when no events have been received? I’m asking because I’m trying to understand how the ui can respond to changes to the closed over state that do not originate from events but from the “outside”.

phronmophobic19:02:27

It depends on the backend. Some of them will check if the view returns something different at least every second regardless. Usually there’s a way to ask for a repaint.