Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple jaspr router does not work on client only app #180

Closed
walsha2 opened this issue Mar 10, 2024 · 3 comments · Fixed by #168
Closed

Simple jaspr router does not work on client only app #180

walsha2 opened this issue Mar 10, 2024 · 3 comments · Fixed by #168

Comments

@walsha2
Copy link
Contributor

walsha2 commented Mar 10, 2024

Description

A very simple routing example, mostly taken from the docs, does not seem to work at all. I find this odd... I am either doing something wrong (e.g. docs are out of date) or this is a very fundamental bug that has yet to be reported for jaspr_router?

Hopefully that can be resolved soon so that we can continue to look into jaspr for a real production use case.

Steps To Reproduce

See the repo below, on the routing branch for a complete working example and a README with other context:

https://github.com/walsha2/jaspr-issues/tree/routing

@walsha2
Copy link
Contributor Author

walsha2 commented Mar 10, 2024

@schultek per the README in that example repo, the project was created using the "Client Template". I think that helps narrow down the issue.

If I created and ran the same project using the basic template it seems to work, but now the server is introduced. So, the routing issue has to do with client side only app templates.

Out of curiosity, why is the client only template not the default (in turn matching Flutter web)? This is the simplest possible web app to build and certainly the simplest to deploy. Rationale as to why SSR is the default? The docs state the note below, but Im sure there are nuances here. I found all of the SSR stuff to be a lot more complicated to configure and get going than just a client side app. Im not sure about the "easily adapt" comment.

Templates give you a minimal project to get started. Later on you can easily adapt your project for every architecture and rendering mode

@walsha2
Copy link
Contributor Author

walsha2 commented Mar 13, 2024

One minor note of clarification, in the example repo linked above, this works:

Router.of(context).push('/about');

However, navigating directly to the page does not work and results in a 404 - again, see example repo.

http://localhost:8080/about

It looks like it is completely bypassing the App router?

class App extends StatelessComponent {
  @override
  Iterable<Component> build(BuildContext context) sync* {
    yield Router(routes: [
      Route(path: '/', builder: (context, state) => Home()),
      Route(path: '/about', builder: (context, state) => About()),
    ]);
  }
}

@walsha2 walsha2 changed the title Simple jaspr router does not work Simple jaspr router does not work on client only app Mar 14, 2024
@schultek schultek mentioned this issue Mar 14, 2024
6 tasks
@neoacevedo
Copy link

neoacevedo commented Apr 19, 2024

Building as a 'template' view for Laravel, if I include the /about in the web.php route file it works but as a static website (client only) it will launch a 404.

UPDATE: I had to create the directory about, copy the index.html inside it and modify the css and js path to make it work. It is jut like to use the app as SSG not as CSG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants