This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-13
Channels
- # announcements (4)
- # babashka (1)
- # beginners (124)
- # calva (5)
- # cider (3)
- # clara (3)
- # clerk (5)
- # clj-commons (14)
- # cljdoc (12)
- # cljs-dev (14)
- # clojure (43)
- # clojure-austin (23)
- # clojure-europe (55)
- # clojure-nl (1)
- # clojure-norway (11)
- # clojure-uk (2)
- # clojurescript (34)
- # conjure (1)
- # cursive (1)
- # data-science (28)
- # datomic (3)
- # fulcro (20)
- # gratitude (2)
- # hyperfiddle (6)
- # introduce-yourself (1)
- # jobs (5)
- # lsp (56)
- # malli (5)
- # membrane (7)
- # mount (5)
- # off-topic (16)
- # polylith (39)
- # portal (38)
- # practicalli (1)
- # rdf (1)
- # re-frame (8)
- # releases (8)
- # remote-jobs (4)
- # shadow-cljs (49)
- # sql (1)
- # xtdb (36)
is there a way to prevent a refresh when a form is dirty the same way navigating away is currently prevented?
You mean you want to control rendering? Fulcro is meant to be as pure of a V = F(data) (view is a pure function of data) as possible. So, thinking about rendering in the sense of preventing a refresh is definitely the wrong way to think about things. Always think: What do I need to do to my data model to represent the state I want in my view, so that then the view can use that state to accomplish the task at hand. So, the question I would ask you is: why did you change the state if you don’t want to see it change? And, why not write whatever this change is in some non-rendered location instead (if it isn’t meant to be viewed)?
no I'm talking about the warning one gets when navigating away from a dirty form: "You will lose unsaved changes. Are you sure?" I was wondering if there was already a way to have the same thing when the user reloads the page / presses F5. With some research I found that in js it's done with
window.onbeforeunload = function() {
return "Data will be lost if you leave the page, are you sure?";
};
You could augment the form state machine to do that for you (add/remove the onbeforeunload handler)
if I do it could I submit it as a PR for RAD? most websites I tested that have forms warning you before navigating away also do it when you refresh
So I’m trying to keep the main form ns free of browser things. I think it would be ok to contribute a form state machine alternative in a new ns that we can pimp out with browser-specific stuff
There doesn't seem to be any option "::report/initial-parameters" as mentioned in https://book.fulcrologic.com/RAD.html#_reports_2
::report/initial-parameters (fn [report-env] {:include-disabled? false})
Has anyone tried OAuth2 based authentication using Fulcro? I am trying to support login via Google or passwordless with email. Struggling to model the events correctly for the auth state-machine.
I ended up implementing this for my app on the backend. I find it more secure to have key communication between my backend and Google auth. I have a ring middleware that checks if you are authenticated and sends you to Google if not.
Interesting. I was trying to do the similar thing. Generally I would respond with 302 status code and Google Auth URI. But when I am doing this fulcro treats this response as Error.
That’s because of https://github.com/fulcrologic/fulcro/blob/main/src/main/com/fulcrologic/fulcro/raw/application.cljc#L137-L141, which you can override by passing in your own impl - https://github.com/fulcrologic/fulcro/blob/main/src/main/com/fulcrologic/fulcro/raw/application.cljc#L234
Oh incredible. Thanks for pointing it out.
Hey @U0522TWDA It didn’t work for me. I looked in the networking code of fulcro.
https://github.com/fulcrologic/fulcro/blob/main/src/main/com/fulcrologic/fulcro/networking/http_remote.cljs#L47
When sending, 302 status code fulcro is treating it as 500, also it’s not passing uri
parameter in the response.
To solve it currently I am sending response with 200 status and redirect-uri. handing that redirect-uri in the frontend.
I don’t understand it completely, how it used to work in other applications just on the basis of redirect status code.
I implemented a google auth via the fulcro-rad auth namespace
Would you be able to share code snippet to let us know how you did it?