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
subsaharancoder 2020-08-23T03:31:04.040700Z

I noticed in my re-frame app that when I refresh a view that's mapped to a URL that has multiple params like /view/123 versus one that's like /path the app tries to look for the compiled js in the new path e.g. view/123/js/compiled/app.js instead of js/compiled/app.js and so I get a 404 error, any idea how to fix this?

2020-08-23T04:00:13.041300Z

You should prefix your paths with / to make them absolute within the server.

đź‘Ť 2
2020-08-23T19:56:55.045400Z

I recently spoke about composing datascript and re-frame together. I have been playing with it for a few weeks and I am completely positive that you can compose the two libraries without any obvious issues for now. I wrote a quick summary on my solution (obviously might not be perfect). The benefit from wrapping datascript inside re-frame, for me, was to keep all the re-frame and application state concept, but still leverage all the query capabilities of datalog. I wrote a small example here:

kenny 2020-08-24T15:03:45.069200Z

Erm, sorry -- I meant datascript db. Posh actually watches the datom changes and will intelligently re-run subscriptions.

2020-08-24T17:14:00.074100Z

Fair point! I was also concerned, but then I think re-frame only recompile subscriptions that are relevant to the current view. So you would need to run the queries anyway?

kenny 2020-08-24T17:14:56.074400Z

Every time you transact data to Datascript, every single DS query will need to re-run even if the transaction did not affect the query.

2020-08-24T17:17:30.077Z

Even if you don’t dereference to the subscription where the queries defined? Anyways, you can circumvent the problem by having multiple datascript datastore, posh forces you to have a single one.

2020-08-24T17:18:11.078100Z

But I will test whether all subscriptions are re run when if you transact.

kenny 2020-08-24T17:19:06.078500Z

If it is not in the view, it won't rerun. In a view with subscriptions, it is highly unlikely that a single DS transaction would affect every single subscription in the given view.

2020-08-24T17:19:48.079400Z

Yes, which minimise the risk of performance issues right?

kenny 2020-08-24T17:22:04.080200Z

No. Take this example... A view is showing the a user's email and a list of products. If you transact any data to Datascript, even if the data isn't relevant to your current view (e.g., you're updating some DS data behind the scenes or storing some internal data), every subscription in your current view will rerun. In a worst case scenario, you'd store the data from an input in DS. This would cause every single query to rerun with each keystroke.

2020-08-24T17:33:30.083200Z

Fair point. To that I answer: you can isolate the data for an input in a different DS in your re-frame app. Reposh forces you to have a single datastore.

2020-08-24T17:39:19.084100Z

But I see your point. I guess I can use posh as well.

2020-08-24T17:42:53.087500Z

I think my biggest issue was that re-posh does not integrate well with re-frame, the disadvantage of this method is that you need to manually partition the different DS databases inside your re-frame DB, and this will solve the performance issue.

kenny 2020-08-23T21:08:24.048400Z

The big downside to this approach is that it will need to re-run all DataScript queries every single time the app db changes. For a small app this might be okay. Anything of size, would likely need something more efficient (e.g., posh).