Hey!
I have a question related to redirecting the browser to a url outside my application. This will happen through a dispatch function. The function is called :route-changed the handler when equal to :aporte-no-ppi and :saiba-mais will redirect. The default is to use the inside router of the SPA.
How would :http/redirect look like? I don't know how to write a function to redirect to external urls.
(rf/reg-event-fx
:route-changed
(fn [{nav :db} [_ {:keys [handler route-params]}]]
(let [nav (assoc nav :pagina-ativa handler)]
(case handler
:aporte-no-ppi {:db (assoc nav :pagina-ativa handler)
:dispatch [:http/redirect :aporte-no-ppi]}
:saiba-mais {:db (assoc nav :pagina-ativa handler)
:dispatch [:http/redirect :saiba-mais]}
{:db (assoc nav :pagina-ativa handler)}))))One way:
(rf/reg-fx
:http/redirect
(fn [loc] (set! (.-href js/location) loc)))Actually, that is an effect handler, not an event, but you get the idea.
Thanks a lot!
When i load reframe10x i get a number of warnings that i assume happen because my version of reagent isn't matching what reframe wants.
Warnings in Library Code:
Wrong number of args (2) passed to reagent.impl.component/get-wrapper
Use of undeclared Var reagent.impl.component/component-name
Wrong number of args (2) passed to reagent.impl.component/do-render
Wrong number of args (2) passed to reagent.impl.component/do-render
Use of undeclared Var reagent.impl.component/component-name
Use of undeclared Var reagent.impl.component/component-name
What would you do to solve this?
• update reagent - risk, lots of things in the app might break
• fix blah bc that's the real problem...
• use a different version of re-frame10x
• don't use re-frame 10x bc blahpotentially relevant SO https://github.com/day8/re-frame-10x/issues/269
looks like i can update my apps reagent or drop down to 10x version 0.7. that's what ill do for now... to the past....
Hey, it would help to know what versions of 10x and reagent you tried. Do you think the https://github.com/day8/re-frame-10x#compatibility-matrix is still accurate?
I'll take a look. Thanks!