fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
magra 2020-10-22T09:03:26.388100Z

What would be a good approach to (rarely) upload a pdf from a fulcro app to the server when I use fulcro-websocket remote? The upload-file namespace needs http-remote. Are there writers to serialize and where would I plug them in and what format would make sense? Or do I register a second remote as http-remote to the same server for uploads since uploads will happen only rarely?

2020-10-22T09:18:46.388700Z

@magra I'd go for the second option, you could use the examples for a file upload remote and not have to adjust it much.

1šŸ™
exit2 2020-10-22T13:48:29.389600Z

Has anyone had any success using https://github.com/cemerick/friend w/ http-kit and fulcro3?

zilti 2020-10-22T13:56:10.389800Z

Fulcro RAD Datomic runs this one for every single account in the entire system after my actual query I posted above has been run and the results are already displayed:

_rad.database-adapters.datomic:-385 - Running [:account/first-name :account/last-name :account/roles :account/job-title :account/headline :account/photo :account/email :account/email-verified? {:account/approved [:tenant/id]} :password/hashed-value :password/iterations :password/salt :account/accepted-tos-version :account/bio {:account/languages [:language/id]} {:account/vendor-type [:vendor-type/id]} :account/vc-contact :account/location {:account/vendor-specialism [:vendor-specialism/id]} {:account/vendor-skills [:vendor-skill/id]} {:account/vendor-geo-expertises [:vendor-geo-expertise/id]} {:account/vendor-industry-experiences [:vendor-industry-experience/id]} {:account/worked-with [:external-company/id]} :account/password-reset-id {:account/links [:link/id]} :account/created :time/created] on entities with  :account/id : [[:account/id #uuid "95a2dbec-ba46-4463-8e5d-5a6eddba95b2"]]

zilti 2020-10-22T13:57:38.390Z

And this query doesn't exist anywhere in my code base. This is every existing attribute where ao/identities is set to :account/id. I have no idea why it gets triggered, and why only in this one case

tvaughan 2020-10-22T15:11:56.390300Z

We chose buddy, and we're happy with it

1šŸ‘
cjmurphy 2020-10-22T15:12:38.390500Z

I wouldn't be loading in :will-enter . I would load in one of three places - start up, user event or timer event. And none of these require :will-enter .

cjmurphy 2020-10-22T15:23:52.390700Z

If you call the df/load just from a button do you get the same problem?

zilti 2020-10-22T15:25:58.390900Z

I will try that tomorrow morning, but a button is not really an option. Might help for debugging the problem though, thanks!

cjmurphy 2020-10-22T15:28:56.391100Z

Also you don't show the resolver or the call site. I'm happy to try to replicate. Button just for debugging the problem, to see if it still happens when simple invocation.

exit2 2020-10-22T19:30:21.391600Z

@tvaughan do you have it thread in the middleware or where did you place it? Iā€™m looking at some of their examples and trying to figure out where it would fit

tvaughan 2020-10-22T19:32:46.391800Z

(defn- auth-required?
  [segment]
  ;; `accounts` and `static` are used to render the signin page, and `sessions`
  ;; is the API endpoint used to authenticate users and create sessions.
  (not-in? segment ["accounts" "static" "sessions"]))

(defn- check-auth-required
  [handler]
  (fn [request]
    (let [segment (nth (str/split (:uri request) #"/" 3) 1)]
      (if (and (auth-required? segment) (not (authenticated? request)))
        (if (in? segment ["api" "static"])
          (response/unauthorized)
          (response/found (urls/route->url (dr/path-to ui/SignIn))))
        (handler request)))))

(defonce ^:private session-auth-backend (backends/session))

(defn wrap-check-auth-required
  [handler {:keys [session-secret]}]
  (-> handler
      check-auth-required
      (wrap-authentication session-auth-backend)
      (wrap-session {:store (cookie-store {:key (s->bytes session-secret)})
                     :cookie-attrs {:http-only true :same-site :strict}})))

tvaughan 2020-10-22T19:33:22.392Z

middelware

1šŸ‘
exit2 2020-10-22T19:48:14.392300Z

thanks @tvaughan

tvaughan 2020-10-22T19:49:08.392500Z

No problem. I hope it's helpful