Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 12 2021 12:30
    fahtative commented #26
  • Sep 12 2021 12:17
    fahtative commented #26
  • Sep 12 2021 12:17
    fahtative commented #26
  • Sep 12 2021 12:13
    fahtative commented #26
  • Sep 12 2021 12:01
    fahtative commented #26
  • Sep 12 2021 12:01
    fahtative commented #26
  • Sep 12 2021 11:59
    fahtative commented #26
  • Sep 12 2021 11:59
    fahtative commented #26
  • Nov 30 2020 19:39
    metasoarous closed #34
  • Nov 30 2020 19:39
    metasoarous commented #34
  • Nov 16 2020 05:16
    metasoarous commented #34
  • Nov 14 2020 12:15
    jpmonettas commented #34
  • Nov 14 2020 12:14
    jpmonettas synchronize #34
  • Nov 14 2020 00:59
    metasoarous commented #34
  • Nov 14 2020 00:58
    metasoarous commented #34
  • Nov 14 2020 00:57
    metasoarous commented #34
  • Jul 22 2020 12:14
    jpmonettas commented #34
  • Jul 21 2020 21:34
    metasoarous commented #34
  • Jul 11 2020 13:34
    jpmonettas synchronize #34
  • Jul 07 2020 12:12
    xlfe commented #35
Baruch Berger
@bbss
no, the pull didn't succeed, this would work with a normal pull though.
Brian Marco
@bamarco
Posh pull returns a ratom not an entity.
Baruch Berger
@bbss
yes, I understand that. But posh pull is the thing that errors so we aren't there yet :D
Baruch Berger
@bbss
but your point about taking the conn, not just db makes me think maybe it's got something to do with devcards
Brian Marco
@bamarco
That's all I got. Good luck though. :smile:
Baruch Berger
@bbss
Okay, thanks for the input :D
posh looks pretty awesome :)
was doing a kind of full rerender approach before, but I think reactive q and pulls will be a lot cleaner/faster
Brian Marco
@bamarco
Yeah, it def cuts down on reloads.
Baruch Berger
@bbss
Hmm, I don't get the same error anymore. I think it's because of the order in which I required..
λex Vincent
@alexisvincent
Hi guys :D Awesome awesome lib. Was wondering how you managed to extract datoms relevant to a query? I can’t seem to find a way to do it and cant quite grok where its happening in the posh codebase
Matt Parker
@mpdairy
hi @alexisvincent thanks! I don't remember exactly, but basically I had to come up with a bunch of rules for various scenarios in q. A simple case would be where q is looking for [?e :some/attrib ?v], then you just look for anytime any transaction with :some/attrib occurs. The functions for figuring this out are insrc/posh/lib/q_analyze.cljc. The simpler version is called pattern-from-eav--old, which is more easy to understand but generates patterns that are much less specific than the query. ("eav" is an entity-attrib-value rule). The more complex function is called pattern-from-eav and unfortunately it worked really well until we found out it missed one common case, which I couldn't figure out how to fix, so posh is just using the simpler one for now.
λex Vincent
@alexisvincent
@mpdairy Thanks! Although I’m particularly interested in extraction at query time. So how do you retrieve the initial set of datoms? Trying to work out if a similar aproach can be used to get initial datoms from a datomic database for sync
Matt Parker
@mpdairy
@alexisvincent Oh yes you could use that initial set of datoms to sync with datomic. if you call q-analyze with the :datoms flag you'll get a list of all the relevant datoms for a query, which you could run on the datomic db and then just send all the datoms over to datascript. How the :datoms thing works, if I remember correctly, is the original query is changed so that instead of returning the stuff specified in the :find of the q query, it just returns all possible combinations of the ? query vars in the :where eav rules. Then to construct the datoms, it goes through all query eav rules and replaces all the ? vars with every possible combos.
to get the actual query results with the :find constraints, it just runs q on the set of possible vars (not the whole db), so it should still be pretty fast
λex Vincent
@alexisvincent
Hmm. That’s clever! Thought you might have figured out a way to it with one query. Pull is a bit more complicated though..? I was wondering about an approach that constructed a filter database specifically for the query and then just saved Datoms it encountered to a set
The catch set might be too large though
Matt Parker
@mpdairy
I think with pulls all the relevant datom info is already in the result of the pull results, so you just have to traverse it and pull out everything as individual EAV datoms.
Have you looked at the Datsync project? They've been working on syncing between datomic and datascript for a while now. I don't know how it's going, but they are active at least.
Oliver Rolle
@orolle
@mpdairy Does posh have the same performance characteristics as rum + datascript? I have read that datascript causes lags in the UI when the database is large (browsers UI thread is blocked)? Is it an option to run a datascript query within a web worker?
Matt Parker
@mpdairy
@orolle Posh should be faster because it doesn't make full queries or pulls every time there is a new transaction, only when a new tx will change the result of a pull/query (this is assuming we're comparing it to a rum + raw datascript that redoes all its pulls/queries every tx). In posh, pull is more efficient than q, so you might be able to get away with a large ui if you use mostly pulls.
i'd just recommend doing some testing before you commit to using it
Oliver Rolle
@orolle
@mpdairy Thanks. I will try it out.
Álvaro Castro-Castilla
@alvatar
Hi @mpdairy, could you provide some pointers on how to use Posh with Rum, please?
Álvaro Castro-Castilla
@alvatar
Seems like this answers my question: mpdairy/posh#27
Camilo Roca
@carocad

hey @mpdairy first of all thanks for the great work that you have done with posh !! that is definitely the missing piece in reactive programming that I was looking for.
I just started working with it and got some errors using pull. I checked the source code and Cursive showed me that there are three functions used with less than their declared arguments; namely

  • posh.plugin-base/missing-pull-result line 20 and 22
  • posh.plugin-base/get-db line 127
    The error that I get is this
object[TypeError TypeError: null is not an object (evaluating 'new cljs.core.Keyword(null,"conn?","conn?",167224275).cljs$core$IFn$_invoke$arity$1(dcfg).call')]
posh$plugin_base$get_db
cljs$core$IFn$_invoke$arity$5
posh$plugin_base$pull
cljs$core$IFn$_invoke$arity$4
G__10589__3
G__10589


eval code
eval@[native code]
figwheel$client$utils$eval_helper

Since I just started working with posh, I am not sure if this is a problem with my configuration or an actual bug in the implementation, so I wanted to ask you first. I am happy to submit a PR to fix that if you want.

Camilo Roca
@carocad
oh it seems that this was already solved in master: mpdairy/posh@61c951b
I dont see a new release in Clojars, though :(
Petrus Theron
@theronic
Any update on Rum support for Posh? :) Posh is the last thing keeping me on Reagent
Christopher Small
@metasoarous
@theronic I don't think anyone has done this yet, but there was a bunch of refactoring that extracted most of the stateful bits of things so that someone could add a rum plugin fairly easily. If you're interested in hacking on that, I'd be happy to point you in the right direction there.
Brian Marco
@bamarco
@theronic i also put a ticket describing what I think needs to take place to make it happen.
Matt Parker
@mpdairy
does anyone want to help me set up posh to automatically compile and do a new release to clojars whenever master changes? I tried before but I couldn't get the auth working.
Camilo Roca
@carocad
@mpdairy I have an auto deploy config with travis ci for one of my projects. I didnt setup the auto deploy myself but I think that the file is pretty self-explanatory. The only things that you would need to change are the your encripted env vars and your release config in project.clj. Links below
Matt Parker
@mpdairy
@carocad thanks! that's just what I needed
Petrus Theron
@theronic
Is there a Leiningen template for a quick blank reagent+datascript+posh project?
Brian Marco
@bamarco
Best I know of is to use lein new chestnut <app-name> -- --reagent then add the posh depency manually.
This message was deleted
eoliphan
@eoliphan
Hi, I'm trying to get re-posh working with my app, but my pretty simple req-query-sub seems to be causing an "Assert failed: (db?db)" exception. Not sure what's going on. I was pulling in the datascript conn via mount, removed that, still have the problem, and did some mucking around and determined that calling connect! without a valid conn, throws an assertion there. So it seems like as of connect! things are fine. unfortunately the stack trace isn't really helping me figure out whats going on. I tried the query with and without ':in $' to no avail
eoliphan
@eoliphan
figured it out, but not sure what the problem is. When I got rid of the pull, everything was ok. But I'm not sure why pull isn't happy. been over the DS, etc docs and it seems like it should
(reg-query-sub
  :cur-form-def
  '[:find (pull ?e [*])    
    :in $
    :where
    [_ :designer/cur-form-id ?id]
    [?e :form/id ?id]
    ])
Oliver Rolle
@orolle
Pulls all fields of an entity via (re-frame/subscribe [:subs/pull entity-id])
(re-posh/reg-pull-sub
 :subs/pull
 '[*])
Petrus Theron
@theronic
There are two problems in Reagent land I keep running into: I forget to update Form-2 component arguments, and I can't get posh to re-render things when I expect to. I want to display the entire the posh db at the bottom of my page so see what's going on. I can never remember when I should deref conn or not. Why doesn't [:code (pr-str @conn)] inside my root component re-render on every db change?
Denis Krivosheev
@denistakeda
@theronic I can be wrong but I suppose that connection is just a regular clojure atom. Reagent doesn't rerender component for regular atom, only for reagent/atom. At the same time q and pull return reagent atom and it works as expected.
Petrus Theron
@theronic
@denistakeda thanks, that probably explains it. How do I get a component to re-render on any change to conn's db?
Denis Krivosheev
@denistakeda
I don't know the easy way to do so. The first idea is to add watcher to this atom that triggers force rerendering of the root component.
But wait a little bit. Maybe somebody else has a better idea
Brian Marco
@bamarco
https://github.com/bamarco/onyx-sim/blob/master/src/cljs/onyx/sim/core.cljs using make-reaction like i do in debug-conn here will work. Haven’t really stress tested it though might just be getting lucky. If you want to be more efficient you could rig up a listen! on the conn.
Oliver Rolle
@orolle
Does posh support running the query execution in a web worker? I have small lacks in my UI and I think about putting the heavy work into workers.
Christopher Small
@metasoarous
@orolle Not at present. I did some preliminary work trying to get it working, but couldn't quite sort it out. In theory it should be possible, as long as you're not putting functions or anything weird in your db. We are looking at the possibility of putting this in datsync fwiw.
Brian Marco
@bamarco
@mpdairy @metasoarous I've got rum working for the most part with posh. I needed to understand posh internals better and this seemed like a way to kill two birds with one stone. Only thing not quite compatible is that rum derived-atoms have no :on-dispose.
Brian Marco
@bamarco
well it almost works. still something not quite right with derived-atoms updating.
Christopher Small
@metasoarous
@bamarco Awesome!