-
Notifications
You must be signed in to change notification settings - Fork 254
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
v2 only works once after page reload #171
Comments
Same for me with react and vite. |
Same for me with React and NextJS |
Same for me with Astro 3.5.x |
Seems like it's the same story with Rails and Turbo. It works on initial page load but not after page is navigated. |
Hey everyone, Our team just recently updated Framework Guides page with live playground demos for all v2 JS components. Please try out with the latest version and let us know if you still have any issues. Cheers! |
Worked for me. Thanks alot |
hey @lenart have you find any way to solve this? its working only with turbo: false... |
Just found myself and used other solutions as reference. Call Preline loaders into turbo:load event. document.addEventListener("turbo:load", function(event) {
HSAccordion.autoInit();
HSDropdown.autoInit();
HSOverlay.autoInit();
HSSelect.autoInit();
}); and call it from your main application.js |
It works |
@ndrshnsn haven't had a chance to try it out myself but it seems like you should call UPDATE: I did what I said above and it works. |
Huge thanks everyone for the updates and sharing the workaround with others - your contributions are truly appreciated! @sebastianbilling @hiteshjoshi if you are still having an issue, please open a new issue with more details. Cheers! |
I copied DOM when dropdown menu not work , below code generated :
and copied Dom when dropdown and other element work correctly , below code
many different , you can use Meld software for tracking differents |
Thanks, worked like a charm. Noted that if you need to use one of these components + Stimulus (dependent dropdowns, for ex) you should call them again in controller - like HSSelect.autoInit() in controller connect Just sharing my findings ;) |
I still am facing issues. I referred to the updated documentation, and made changes accordingly. However, the build fails with Please find the details here |
Still the same. If I add a new item on the fly after preline load, it won't work. |
Yup, it behaves very strange. Had to go back to v1.9.0 So at whatever point my dom adds a new dropdown it works in 1.9.0 |
I solved it. ./node_modules/preline/preline.d.ts declare global {
interface Window {
HSStaticMethods: {
afterTransition(el: HTMLElement, cb: Function): void;
getClassPropertyAlt(el: HTMLElement, prop?: string, val?: string): string;
getClassProperty(el: HTMLElement, prop?: string, val?: string): string;
autoInit(collection: string | string[] = 'all'): void;
};
}
} ./components/PrelineScript.tsx useEffect(() => {
setTimeout(() => {
- HSStaticMethods.autoInit();
+ window.HSStaticMethods.autoInit();
- }, 100);
+ }, 300);
}, [path]); |
I can confirm this; using Livewire, and preline v2.0.2, but rolling back to v1.9.0 it works perfectly. |
Can confirm, JS features like tabs don't work properly in v2, it stops working on HMR or page navigation, hopefully a fix will come soon |
@umaraziz0 Check out #205 it has an approach that may work for you. |
Hi for anybody here and using HTMX and sent partial HTML from server we can use htmx load event like this document.addEventListener('htmx:load', function() {
....
} |
Has anyone gotten HMR to work with Inertia + React? I looked at the Preline framework guide for React and it's slightly different due to how Inertia initializes a React app, which is like this:
Trying to use useEffect and useLocation as recommended by the framework guide somewhere here won't work as this isn't a component function, and the App component sent to the render function doesn't appear to be an actual component file in my js directory, otherwise I'd try adding the hooks there. Any help is so greatly appreciated. |
Could you please share your file of app.jsx?? |
I had the same issue. I resolved it by maintaining the guidelines...Preline maintains that: "projects_root_directory/app/components/PrelineScript.tsx", meaning the PrelineScript.tsx component must be housed within a components folder in the app directory. |
@ode96-dev thanks |
I use Laravel 10 with inertia and vue3.
Every javascript trigger only works after a page reload.
When navigating to another page and go back in my SPA none of the javascript is working.
With version 1.9.0 everything is fine (except the new added plugins :)).
Is version 2.0 compatible with inertia?
The text was updated successfully, but these errors were encountered: