This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-18
Channels
- # announcements (7)
- # babashka (4)
- # babashka-sci-dev (73)
- # beginners (101)
- # biff (4)
- # calva (33)
- # clerk (36)
- # clj-commons (23)
- # clj-kondo (3)
- # clojure (38)
- # clojure-europe (2)
- # clojurescript (29)
- # datalevin (15)
- # emacs (2)
- # fulcro (8)
- # gratitude (1)
- # hugsql (9)
- # hyperfiddle (43)
- # jobs-discuss (4)
- # lsp (47)
- # malli (7)
- # off-topic (14)
- # pathom (5)
- # practicalli (1)
- # releases (7)
- # shadow-cljs (4)
- # spacemacs (6)
- # sql (7)
- # tools-deps (7)
- # transit (8)
- # xtdb (6)
We're doing a hack week next week, any ideas as to what we should build? I list some ideas here: https://twitter.com/dustingetz/status/1637081011761684480
Cooperative spreadsheet app, possibly using https://github.com/pixelated-noise/hike https://www.pixelated-noise.com/blog/2022/03/01/hike/index.html
@UEJ28A9PH help me imagine what this spreadsheet would be used for, is this just a simple google sheets thing where you can add and remove rows and assign values? What is the business use case that you have in mind
Bacisally a google sheets clone with som simple formulas and stuff. I didnt have a business case in mind, just thought it would be cool. Especially if it was still performant with somewhat large data sets :) However, the other ideas are indeed more useful 👍
How about instead of using some kind of mock excel language (=IF(...)) we'd "sink" back to clojure? I.e formulas would be clojure exp which can reference other cells in the spreadsheet? Besides the obvious power proof for electric, a spreadsheet that can tap into clojure, IMHO, would be priceless...
I'd like to see business applications with forms validations, form sessions, multipart forms, dialogs, file upload, consideration for conflicting updates, form history - everything you'd want to do a generic web form, defined declaratively for easy implementation
I'd like to see an extensible, lightweight database UI. Connect to datasource (next.jdbc?), browse around. Could be interesting as a sidecar when developing. Seeing the database state live, possibly extending the viewers. Easy batch editing.
Hello there, getting my feet wet with electric and I’m already trying something impossible 😉
I’d like to use the highlight.js
library and looking for a way to mutate a DOM element after it has been mounted.
The MDN answer is: use MutationObservers, but for those I also need a reference to the DOM element.
Any idea on how to do this?
(I’ve spotted the on!
and on
fns/macros but there’s no suitable DOM event anymore to attach to)
Can you elaborate a bit on the use case? Their web page shows simple examples that should work in electric as is
dom/node is in dynamic scope, it is the node at current point
mount and unmount looks like this: https://github.com/hyperfiddle/electric/blob/cd748d059c0035cbbb8140f4c829b200fc374d36/src-docs/user/demo_chat_extended.cljc#L52-L53 ; note that mount is the same as first render
getting closer and what I really need is an effect that runs when a node updates (so I can ask highlight.js to highlight the current node again) So stuff like this works:
(dom/code (dom/props {:class "language-clojure"})
(dom/text "{:a :b}")
(highlight/highlightElement dom/node))
but this won’t, since it doesn’t re-run highlightElement.
(dom/code (dom/props {:class "language-clojure"})
(dom/text (e/server (pr-str project)))
(highlight/highlightElement dom/node))
Which should be obvious to me if I would know electric a bit better 😉I haven’t found an example yet that shows how to integrate with one of those good old-fashioned JS libraries that want a dom element to mess with (and don’t observe any DOM changes themselves)
I dont understand the webcomponent fix, can i see the code?
> what I really need is an effect that runs when a node updates (so I can ask highlight.js to highlight the current node again) Here is a solution, it requires you to think in terms of the DAG / reactivity graph
(defn highlight! [node _]
(highlight/highlightElement dom/node))
(dom/code (dom/props {:class "language-clojure"})
(dom/text (e/server (pr-str project)))
(highlight! dom/node project)) ; establish reactive dependency on project
I’ve since switched to a web component that takes the data from project directly and that makes it reactive
I'd like to see it [webcomponent] if it is easy to copy/paste
I’m using this one: https://github.com/alenaksu/json-viewer Here’s my example component. Surprisingly it can deal with CLJS objects.
(e/defn JSONView []
(e/server
(binding [project (e/watch d/project)]
(e/client
(dom/div
(dom/element "json-viewer"
(dom/props {:data (e/server project)}))
)))))
(calling :data (cljs->js (e/server project))
fails with an error message for reasons unknown)json-viewer doesn’t quite fit the bill as keys are unsorted, so I might build my own viewer for tree-like data-structures anyways. Sigh. Too much effort to fork json-viewer, change one line, and get it into the project 😉
@U4YGF4NGM started an electric tree viewer, it's in https://github.com/hyperfiddle/electric/blob/master/scratch/photon_tree.cljc
Hi, I use the following for history (slightly modified from electric examples.) [1] This used to work no issues since switching to master I started getting the following error, back/forward navigation still works but I lost the ability to reload the app from a specific view. i.e /app#/some-page
[1] https://gist.github.com/nakkaya/fb5acbebf8ff7a4f468fa92b6a0b7342
i have no idea, will look into it tomorrow, if you can link me to the right place in your repo that would help
👍 Thanks for looking into it. Here is history.cljc
[1] and core.cljc
[2].
[1] https://github.com/nakkaya/dentmetria/blob/main/src/app/history.cljc
[2] https://github.com/nakkaya/dentmetria/blob/main/src/app/core.cljc
from @sr (who did Electric Painter) - one day
The demo (and other game demos) has input latency, I spoke with Dag about it. We're going to fix it. The issue is that Electric's operators are designed for database apps, Electric has optimistic form controls but games don't match the form pattern
we don't intend to abstract over conflict resolution, which is the hard part right? userland can arrange a transaction or CRDT strategy
abstractly, a form is a sequence of keyboard events, and a mouse gesture is a sequence of mouse events, and a game input is a sequence of keyboard events, I think the naive interactions can be fast like our form elements are
Is "clicked on a thing" a mouse event? server and client may disagree on whether that happened
that's a conflict, we don't intend to abstract over that
+ we need a user story, "clicked on a thing" is a fact, and the client has authority over that fact
We also just discovered two additional issues 1. Railway has 200ms ping across the atlantic ocean whereas http://fly.io has 30ms for the same 2. in the painter app, DOM performance slows down linearly with number of strokes, this is a userland issue that i will help fix and of course (3) the optimistic state update issue remains (in games not forms) even with low ping, we take that seriously
@sr we fixed the glitchy input, it was a mistake in the userland code in the RPG app, sent you a PR