Fork me on GitHub

how do i call core.clj functions from core.cljs? do i have to use ajax, or is there another way?


If your cljs app runs inside the browser and your ring server runs on the server side, then you will need to use some client-server approach. So, ajax would work.


i tried following an article to set up a ring server, with no luck


I have a small Reagent app. I'm reading data off of a websocket, and I append new data to a vector in my single ratom appstate. I also eject old data, so basically imagine a table with 100 rows, with new data always added to the bottom, old data ejected from the top.


Then I'm generating html(hiccup) from the state, where it generates the html table (among other stuff).


I have this table in a scrolling window in the middle of my UI (this will be for small screens, so, you can only see 15-20 rows of data). What I would like is to always have my table automatically scrolled to the bottom every time the data is updated.


My problem is that I appear to have some sort of race condition. It appears that the scroll-to-bottom logic runs before the updated html is generated & rendered to the DOM.


I have a reagent atom in a separated file. In my view file I have a table in a component and an input+button in another. When I type something in and fire the button it send a POST request and then a GET to fetch new data and update (with swap!) the atom. But the table is not correctly refreshed, after the list is truncated and pressing again the button will correctly display the values. If I manually swap in repl it works well. I don't have the code at home but you may help me :)


Because many times (not always, but most commonly) the list is only scrolled to the next-to-last item in the table, rather than the bottom.


My current approach is to simply run the scroll-to-bottom code after doing swap! on my ratom. I'm wondering if there's not some other approach? Like, is there some kind of way to register "rendering postactions" in reagent?