wireui / wireui

TallStack UI components
https://v1.wireui.dev
MIT License
1.37k stars 166 forks source link

Vite always reloading files on page with "x-select" #406

Closed LaMance22 closed 1 year ago

LaMance22 commented 1 year ago

Hello, i have problem.

When I add the "<x-select" option to my blade (in livewire), vite reloads all of them. Using "<x-native-select" everything works fine.

ss1

My composer.json.

    "require": {
        "php": "^8.0.2",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^9.19",
        "laravel/jetstream": "^2.10",
        "laravel/sanctum": "^2.14.1",
        "laravel/tinker": "^2.7",
        "livewire/livewire": "^2.5",
        "power-components/livewire-powergrid": "^3.2",
        "psr/simple-cache": "1.0",
        "wireui/wireui": "^1.13"
    },

Thanks for working on this project - good job.

PH7-Jack commented 1 year ago

@LaMance22 Could you share your vite config?

LaMance22 commented 1 year ago

Sure,

import { defineConfig } from 'vite'; import laravel, { refreshPaths } from 'laravel-vite-plugin'; export default defineConfig({ plugins: [ laravel({ input: [ 'resources/css/app.css', 'resources/js/app.js', ], refresh: [ ...refreshPaths, 'app/Http/Livewire/**', ], }), ], });

@Update With "<x-datetime-picker" is the same problem.

PH7-Jack commented 1 year ago

@LaMance22 Your config likes normal for me. I don't know what is causing this bug. I can use the wireui with vite. Try updating the dependencies

LaMance22 commented 1 year ago

I did not add the most important point. Everything works fine after executing "npm run build", but if it works on the "npm run dev" environment, vite will reload the page every time if it is "<x-datetime-picker", "<x-select". It does not require urgent repair, but I do report it.

PH7-Jack commented 1 year ago

Could you record a video showing this behavior?

racerguy commented 1 year ago

I am also having this problem. Seems to come up with x-selects in WireUI modals for me.

racerguy commented 1 year ago

Could you record a video showing this behavior? Screenshot 2022-08-16 032236 Screenshot 2022-08-16 032214

PH7-Jack commented 1 year ago

@racerguy Could you share your vite config? Could you record a video on loom? I cant reproduce this behavior

racerguy commented 1 year ago

I will try to get a video of it. It tends to cause a meltdown of vite and crashes chrome and node.

`import { defineConfig } from 'vite'; import laravel, { refreshPaths } from 'laravel-vite-plugin';

export default defineConfig({ server: { hmr: { host: 'localhost', }, }, plugins: [ laravel({ input: [ 'resources/css/app.css', 'resources/js/app.js', ], refresh: [ ...refreshPaths, 'app/Http/Livewire/**', ], }), ], });`

racerguy commented 1 year ago

I think it maybe looping because some function from wire-elements is also found in wireui

racerguy commented 1 year ago

It's an error with the laravel vite auto refresh, using https://github.com/def-studio/vite-livewire-plugin gives me no problems

PH7-Jack commented 1 year ago

@racerguy Nice finding. Interesting plugin

PH7-Jack commented 1 year ago

I believe it can be closed since it's not a wireui issue. If I'm wrong, just tag me to reopen the issue

racerguy commented 1 year ago

@PH7-Jack Still having problems with this. Plugin seemed to help and so did using incognito window for about a day. Something weird is going on. I have 4 selects, 1 date input, 3 text inputs loading on a modal.

I am on WSL using sail

racerguy commented 1 year ago

Is there any possibility that wireui is modifying files in a way that Vite is picking it up as a change?

PH7-Jack commented 1 year ago

@racerguy As I said before, record a video that shows your problem, I cant reproduce it. I can also use wireui with vite with no problem, the wireui scripts don't need to use the vite build, they are a build. Try to update your vite config https://github.com/laravel/jetstream/blob/2.x/stubs/livewire/vite.config.js I believe the vite is listening for the laravel blade cache

minhtamwebmaster commented 10 months ago

I did not add the most important point. Everything works fine after executing "npm run build", but if it works on the "npm run dev" environment, vite will reload the page every time if it is "<x-datetime-picker", "<x-select". It does not require urgent repair, but I do report it.

I also encountered a similar problem