htmlstreamofficial / preline

Preline UI is an open-source set of prebuilt UI components based on the utility-first Tailwind CSS framework.
https://preline.co
Other
4.9k stars 309 forks source link

A navigation cycle produces an error #396

Closed daninus14 closed 5 months ago

daninus14 commented 5 months ago
  1. Starting in route /a/ navigate to route /a/b/
  2. navigate to route /a/
  3. navigate to route /a/b/
  4. navigate to route /a/

At some point it produced an error for me. It's unclear to me if this is for any cycle or just a specific one. I just know that after an unbelieveable cryptic error message, by commenting out:

useEffect(() => {
    window.HSStaticMethods.autoInit();
  }, [location.pathname]);

I was able to stop the error from happening. This is a preline setup.

This is the error message I am getting (redacted)

The above error occurred in the <App> component:

   at App (http://localhost:4200/src/app/app.tsx:28:20)
   at RenderedRoute (http://localhost:4200/@fs/Users/username/project-name/node_modules/.vite/main/deps/react-router-dom.js?v=6be11204:2975:5)
   at Routes (http://localhost:4200/@fs/Users/username/project-name/node_modules/.vite/main/deps/react-router-dom.js?v=6be11204:3320:5)
   at Router (http://localhost:4200/@fs/Users/username/project-name/node_modules/.vite/main/deps/react-router-dom.js?v=6be11204:3267:15)
   at BrowserRouter (http://localhost:4200/@fs/Users/username/project-name/node_modules/.vite/main/deps/react-router-dom.js?v=6be11204:3680:5)
   at RecoilRoot_INTERNAL (http://localhost:4200/@fs/Users/username/project-name/node_modules/.vite/main/deps/recoil.js?v=6be11204:2818:3)
   at RecoilRoot (http://localhost:4200/@fs/Users/username/project-name/node_modules/.vite/main/deps/recoil.js?v=6be11204:2936:5)

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.

Quick question: Is it possible to use preline without the javascript addon? If I just skip adding the javascript installation https://preline.co/docs/index.html is there anything beyond the plugin https://preline.co/plugins.html functionality lost?

Preline is primarily the design of the components. That is why I'm asking...

jahaganiev commented 5 months ago

Hey @daninus14 - yes, you can use Preline's components without installing it but it's required to install if you would like to use JavaScript components such as Dropdown, Modals etc.

daninus14 commented 5 months ago

Great, thanks. I thought I had read that in the docs somewhere as well, but couldn't find it.

Any ideas why this error is happening and how to fix it? I'm hoping it's easier than switching to another headless library.