Fork me on GitHub
#funcool
<
2021-02-28
>
ribelo12:02:46

how do I get beicon to work?

ribelo12:02:01

i have a problem with The required namespace "beicon.impl.rxjs-operators" is not available

ribelo12:02:27

I have added rxjs to package.json

ribelo12:02:25

problem solved, in node-repl it doesn't work, in browser-repl there is no problem

ribelo12:02:51

still something doesn't work ;(

ribelo12:02:13

The required JS dependency "rxjs/Rx" is not available, it was required by "beicon/impl/rxjs.cljs"

ribelo13:02:54

from what I see and read, the library is set up to work with figwheel, not shadow-cljs

ribelo17:02:29

why does ptk/add-watch not call the function added with add-watch to ptk/store?

niwinz17:02:36

hi @huxley, we are using beicon at https://github.com/penpot/penpot and it works correctly with shadow-cljs, but it needs some tweaks in order to correctly work

ribelo17:02:00

Yes, I know, I found 😉

ribelo17:02:25

I have already added the files from the vendor directory

ribelo17:02:01

oh yeah, that's files

niwinz17:02:18

about potok, unfortunatelly the documentation is outdated; as I don't expected that the library is heavy used outside from my own projects 😛

niwinz17:02:11

because is not very popular way to handle state, and the the people used to have some fear to RX

ribelo17:02:30

regarding ptk/add-watch, I have already found that (rx/delay) messes everything up

ribelo17:02:08

I'm tired of re-frame & reagent and looking for something new

niwinz17:02:29

hehe nice, probably penpot is a good source for knowing how potok+beicon works; the badside is that the project is pretty big that does not help

niwinz17:02:55

i'll try to have some time this week for update potok documentation

ribelo17:02:29

I'm maintaining >5 years old ecommerce that uses rum fork rum and datascript fork. Compared to it penpot is lovely, simple, organized and super readable 😉

ribelo17:02:53

Anyway, don't worry about the documentation, it's all in the code, which is well described.

niwinz17:02:57

oh, thanks! 😊

ribelo17:02:04

btw, you are probably the best example of a person suffering from a lisp course 😉 you produce an incredible amount of libraries and you always use your own solutions

ribelo17:02:32

and that's great, because less able people like me have it easier

niwinz17:02:42

hehehe, i'm just curious and try to find a simple solutions for my own problems and challenges; and spend a good amount of time on research on how to improve the currently established solutions

niwinz17:02:47

the potok, rumext and okulary is probably a portion of result of this; potok right now is probably 5 years old and it has aged pretty well; we as a team developing penpot did't found real obstacles with the current architecture of state management of the application... I didn't have the same experience with redux, flow and other similar aproaches form the JS world

niwinz17:02:05

potok only suffers from the learning curve, because it requires knowing rx pretty well for more advanced stuff

ribelo18:02:41

I'm just trying to figure out how to display the rx/stream data using rum

ribelo18:02:29

I haven't seen rx/to-atom used anywhere in the penpot, and that's the only thing I can think of

niwinz18:02:04

@huxley this is something related to documentation 😞 ; look at this line https://github.com/penpot/penpot/blob/develop/frontend/src/app/main/store.cljs#L26

niwinz18:02:13

the state is already an atom

niwinz18:02:20

so you can use it from rum as-is

niwinz18:02:01

the idea behind this, is that all changes are async, but state should be accessed using synchronous primitives

ribelo18:02:34

I got what you're talking about, it's easy

ribelo18:02:54

but I've got another idea I can't make happen

ribelo18:02:50

I know I can use l/derived too, but that's not what I have in mind yet.

ribelo18:02:09

I'll try to explain in my limited English

ribelo18:02:42

You definitely know datascript and maybe you know posh

niwinz18:02:09

yeah, I know it but never used it

ribelo18:02:35

The posh listens for changes in the db, and checks if these changes match the query

ribelo18:02:53

I wanted to make a stream where I have the difference between old-db and new-db

ribelo18:02:02

I've already got it

ribelo18:02:30

I also have functions that listen for these differences and based on them return something

ribelo18:02:06

and I'd like to use this "something" with rum

niwinz18:02:41

probably the easiest way to it is materialize the result of a stream into an atom

niwinz18:02:18

atom is a good synchronous primitive for storing the result of a curret result of some process

niwinz18:02:02

if you have a stream of "something" (results)

niwinz18:02:15

just use to-atom for materialize it to an atom

niwinz18:02:40

you also have the option to use BehaviorSubject of RX

niwinz18:02:55

is analogous to atom

niwinz18:02:23

but need some adaptations in order to make it work with rum

ribelo18:02:24

I tried to do a deref a subject

ribelo18:02:23

but it looks like the data needs to be pulled out somehow differently

niwinz18:02:23

For rumext, we have this hook (react hook)

niwinz18:02:44

is analogous to rum and rumext deref

niwinz18:02:57

for subjects

ribelo18:02:15

this is it!

ribelo18:02:35

I think I have all the pieces of the puzzle to replace the current stack

ribelo18:02:43

thank you, you helped me a lot