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

DKAN JS Frontend module - ReadMe Section Tips #4121

Open
stefan-korn opened this issue Feb 13, 2024 · 1 comment
Open

DKAN JS Frontend module - ReadMe Section Tips #4121

stefan-korn opened this issue Feb 13, 2024 · 1 comment
Assignees

Comments

@stefan-korn
Copy link
Contributor

stefan-korn commented Feb 13, 2024

Describe the bug

I suppose the "Tips" section of the ReadMe file for DKAN JS Frontend module is not correct anymore:

Set the 404 and home paths for the site to /home. This will make it so whenever Drupal returns a page not found it will load the JS frontend and visiting the root url the JS site will be loaded instead of a default Drupal node.

This will not work anymore, probably since release 1.4.0 of data catalog app, precisely since GetDKAN/data-catalog-app#129

Now going to /home will give an "Unexpected Application Error" from the React app, see https://demo.getdkan.org/home

And if you use /home as 404 path in Drupal it will also give this "Unexpected Application Error" whenever a 404 occurs.

To fix the issue with /home one could add the "/home" path in the data catalog app: https://github.com/GetDKAN/data-catalog-app/blob/main/src/index.jsx#L19

But this would not solve the problem with the 404 path as far as I could see. This will still result in the "Unexpected Application Error". I suppose this is due to different handling of React Router. Seems it would need something like this at the end of https://github.com/GetDKAN/data-catalog-app/blob/main/src/index.jsx#L46:

  {
    path: "/*",
    element: <Home />
  },

Steps To Reproduce

  • Go to https://demo.getdkan.org/home and see the "Unexpected Application Error".
  • Doing like described in the Tips and set the 404 path to /home, then go to a url that produces a 404., see the "Unexpected Application error" too.

Expected behavior

Behave like described in the Tips section

@dgading
Copy link
Member

dgading commented Feb 23, 2024

I just started working on a couple of PRs in the data-catalog-app GetDKAN/data-catalog-app#145 and GetDKAN/data-catalog-app#144 that should fix this. I may have to work on the Drupal config in the ddev demo build if there are any more issues.

In our router file we didn't have two routes that were causing the issues:

  1. The home route wasn't specified to redirect to root, so it would be treated as a 404/page not found.
  2. We didn't have a wildcard route at the end of the router setup to catch all other routes and send to the NotFound page. The Unexpected Error messaging was being served by React since it didn't know what to do when given an incorrect route.

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

No branches or pull requests

2 participants