electric
electric copied to clipboard
Undesired reference transfer caused by eager let and sited lambdas
We don't yet know how hard this is to fix; for now you can work around with bindings and careful application
; undesired transfer caused by sequential let
(e/client (let [db (e/server (d/db !conn))] (e/server (do db nil)))
; undesired transfer caused by eager argument passing (?)
(e/defn Foo [db]
(e/client
...
(e/server db)))
(e/server
(let [db (d/db !conn)]
(e/client
...
(Foo. (e/server db)))))
This is all but solved by a convention of "calling all p/fns from the server"; we have been running with a server-based entrypoint for months now and the pain has vanished
Full solution (colorless lambdas) is understood and on the roadmap; in the meantime the partial solution (call all electric fns from the server) has in practice eliminated the issue in practice at the application layer. At the electric-ui layer, lack of colorless lambdas is currently forcing overuse of macros for complex widgets like typeahead autocomplete.