fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
tony.kay 2021-04-24T00:58:04.208100Z

if you require the ns, you get the component. If you get the component, you get the warning. I need to fix that component, evidently 😄

hadils 2021-04-24T02:47:27.208400Z

I am not requiring the ns.

tony.kay 2021-04-24T05:40:30.208500Z

Transitively you certainly are

Jakub Holý 2021-04-24T07:44:52.210800Z

🙏 input needed 🙏 What exercises would you give a beginner? I am trying to make a hands-on, exercises-based follow-up to the Minimalist Fulcro Tutorial and would appreciate you ideas, both from beginners and experienced folks, about what exercises / tasks would be conductive to learning Fulcro. This is what I have so far: https://github.com/fulcro-community/fulcro-exercises/blob/master/src/holyjak/fulcro_exercises.cljs#L21

2021-04-24T10:25:29.211100Z

@holyjak one of the things missing on most examples is the separation between "model data" and "ui data".

Jakub Holý 2021-04-24T10:29:17.211200Z

Could you please clarify?

Timofey Sitnikov 2021-04-24T11:57:57.214600Z

Good morning!!! I am looking at the https://github.com/fulcrologic/fulcro-template, and it seems like everything is in place for the routing, except the dr/change-route! SPA, which I added to https://github.com/fulcrologic/fulcro-template/blob/db259312050524ba677f0ed9a3de434d7913bc23/src/main/app/client.cljs#L24 like so:

(defn ^:export init []
  (log/info "Application starting.")
  (cssi/upsert-css "componentcss" {:component root/Root})
  (app/set-root! SPA root/Root {:initialize-state? true})
  (dr/change-route! SPA ["main"])             ;; <<<< Added route here
  (log/info "Starting session machine.")
  (uism/begin! SPA session/session-machine ::session/session
    {:actor/login-form      root/Login
     :actor/current-session root/Session})
  (app/mount! SPA root/Root "app" {:initialize-state? false}))
but when I enter any route, I get the NOPE as the http response. So it looks like the dynamic router is not activated, how can I get it to activate?

Björn Ebbinghaus 2021-04-24T12:01:28.214900Z

The "NOPE" response comes from the backend router. wrap-html-routes in middleware.clj doesn't match /signup

Björn Ebbinghaus 2021-04-24T12:01:45.215100Z

So it falls through to the not-found-handler

Timofey Sitnikov 2021-04-24T12:05:32.215300Z

@mroerni, that makes sense but there is a signup route, its https://github.com/fulcrologic/fulcro-template/blob/db259312050524ba677f0ed9a3de434d7913bc23/src/main/app/ui/root.cljs#L44 , why does it fall through?

Björn Ebbinghaus 2021-04-24T12:32:05.219300Z

This is completely unrelated. The dynamics routing stuff is client-side routing. The code in middleware.clj ist server-side and has nothing to do with what the client does.

Timofey Sitnikov 2021-04-24T12:36:13.219500Z

@mroerni OK, how do I get the client-side routing to work on Fulcro Template? It looks like the client sider router is not starting.

Timofey Sitnikov 2021-04-24T12:38:13.219700Z

But it does look like all the code is there for it to work. So you should be able to got to localhost:3000/signup and the client side should be able to bring up the signup dialog.

Björn Ebbinghaus 2021-04-24T13:04:35.221Z

You don't even load the client. The "NOPE" Route just gives you a webpage containing only the string "NOPE", no HTML, no CSS, no JS -> no client

Timofey Sitnikov 2021-04-24T13:11:25.221200Z

@mroerni, I do load the client, when I go to localhost:3000, I get below, but when I enter the localhost:3000/singup, I expect the client to intercept the route and change to signup dialog. Actually, I think I may have found it possibly in the https://github.com/fulcrologic/fulcro-template/blob/master/src/main/app/server_components/middleware.clj, the routes need to be passed back to index.

Björn Ebbinghaus 2021-04-24T13:16:42.221600Z

You load the index functions HTML on / or /index.html like stated here: https://github.com/fulcrologic/fulcro-template/blob/master/src/main/app/server_components/middleware.clj#L74 When you enter a URL in your browser, and you hit enter, it has nothing to do with the client.

Timofey Sitnikov 2021-04-24T13:23:40.221900Z

@mroerni OK so looking at https://www.youtube.com/watch?v=oQpmKWBm9HE starting at 1:15, Tony demos the client sider routing, thats what I am trying to achieve. If I am understanding it correctly, later when Tony types in a route, it does not do http request to server, it just resolves it in the client. Is that true or am I totally missing the point?

Björn Ebbinghaus 2021-04-24T13:43:08.222200Z

Ok.. 1. Tony has the all-routes-to-index function, which means, that no matter which route (as long as it doesn't end with .js, .css, ...) it gets treated as if it would be / . This resolves the problem, that you get the NOPE route from the template. 2. When changing the URL by hand and pressing enter in your browser, you change your site, nothing you can do about that. On the other hand. When clicking a link or using the nav buttons, you can prevent-default(which would be a reload of the page) 3. You still have to change-routewhen the client starts. dynamic routing is not automatic HTML5 routing.

1
❤️ 1
Timofey Sitnikov 2021-04-24T13:44:20.222400Z

Yes, that is what I am trying to achieve. the server side routing.

Björn Ebbinghaus 2021-04-24T13:45:07.222700Z

I modified my answer. I sent it prematurely by mistake.

Björn Ebbinghaus 2021-04-24T13:47:33.222900Z

So in your backend. (middleware.clj in this case) you would add a catch-all rule (or whatever you want/need), so that you get the page + client. Then in the next step, when your client starts, you can change-route! based on your location.

1
❤️ 1
2021-04-24T13:49:34.223100Z

Sure. Most of the examples talk about person, addresses, etc These is normally data that is loaded from the backend. However complex spas require management of info that is exclusive to the frontend. Example: active menu, show/hide sidebar.

👍 1
2021-04-24T13:52:54.223300Z

It would be nice to see an example showing both types of data.

Jakub Holý 2021-04-24T13:54:10.223500Z

Ok, thanks! Good idea!

Björn Ebbinghaus 2021-04-24T22:57:49.230400Z

I have a problem, that I get Cannot find app on component! or Cannot create proper fulcro component, as *app* isn't bound. just in my release JS and I don't do things like function as a child. I started a discussion on GitHub and I would be grateful, if anyone could point me in the right direction as to what is causing this. https://github.com/fulcrologic/fulcro/discussions/477

Björn Ebbinghaus 2021-04-25T13:17:27.236600Z

Hm. Yes. Surrounding for with vec works... How annoying... Thank you very much.

Jakub Holý 2021-04-26T08:39:39.252200Z

@mroerni could you be so very kind and send a PR explaining this better here https://github.com/fulcrologic/fulcro-developer-guide/blob/master/AppendixFulcroErrorsAndWarnings.adoc#user-content-err-comp-app-not-bound for future users that run into this? 🙏

Björn Ebbinghaus 2021-04-26T10:44:34.253300Z

That's why I posted it as a GitHub discussion. https://github.com/fulcrologic/fulcro/discussions/477 I mean... What is the problem here? Fulcro? CLJS? React? Shadow-cljs? 🙂

tony.kay 2021-04-26T13:15:35.253500Z

A combo of the first three 😄 Fulcro uses a dyn var that is bound on render, cljs allows for laziness, and React switches modes between error checking (and not) that causes forces eval of the laziness in dev.

Björn Ebbinghaus 2021-04-28T09:15:57.271700Z

@holyjak I have not forgotten you: https://github.com/fulcrologic/fulcro-developer-guide/pull/84

❤️ 1
Timofey Sitnikov 2021-04-24T23:45:07.230900Z

@mroerni, took me a while, but still struggling 😞, but a different issue, will post for help again.