livewire / flux

The official Livewire UI component library
https://fluxui.dev
476 stars 41 forks source link

Works locally but not on staging #534

Closed shomarim closed 2 weeks ago

shomarim commented 2 weeks ago

Hi I am getting a javascript error (see below) when I deploy to a Laravel Forge server. The environment is set to staging with debug on. I've tried changing to production and disabling debug to no avail. I confirmed that FluxUI is configured. I can do a composer install on the server. My deploy script is below. What am I doing wrong?

Image

cd /home/forge/sitename.com
git pull origin $FORGE_SITE_BRANCH

$FORGE_COMPOSER install --no-dev --no-interaction --prefer-dist --optimize-autoloader

( flock -w 10 9 || exit 1
    echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock

if [ -f artisan ]; then
    $FORGE_PHP artisan migrate --force
fi

npm ci && npm run build

$FORGE_PHP artisan queue:restart

$FORGE_PHP artisan filament:optimize

$FORGE_PHP artisan optimize
shomarim commented 2 weeks ago

After further debugging, it appears the javascript error also occurs locally; however, the UI still functions. The UI only breaks on the Forge server.

joshhanley commented 2 weeks ago

@shomarim Can you double check what version of Livewire and Flux you are on by running composer show -D and share that here?

Also can you confirm that the Flux JavaScript file is being downloaded correctly by the browser?

shomarim commented 2 weeks ago

@joshhanley sure.

livewire/flux-pro                  1.0.13  The pro version of Flux, the official UI component library for...
livewire/livewire                  3.5.10  A front-end framework for Laravel.

The Javascript file seems to be downloaded correctly. Image

joshhanley commented 2 weeks ago

@shomarim Please update to the latest Flux version v1.0.17 and Livewire v3.5.12 and test again. A bunch of bugs have been fixed but it needs latest Livewire.

shomarim commented 2 weeks ago

@joshhanley Ok I'll try that. I also noticed that it only appears to happen with this block of code. I'm using Flux on other screens and they work fine but this particular block generates the JS errors. Image

joshhanley commented 2 weeks ago

@shomarim Can you please share the code as text, not a screenshot, so we can copy paste it to investigate. I suspect it's because you are using field without an input.

shomarim commented 2 weeks ago

You're right. The error disappears if I add an input field. Thanks for your help. I'll find an alternative way to display the read-only text without an input field.

shomarim commented 2 weeks ago

@joshhanley Last question... Does the order of the styles and scripts matter in app.blade.php?

        @livewireStyles

        @filamentStyles

        @fluxStyles

and

    @livewireScripts

    @filamentScripts

    @fluxScripts
joshhanley commented 2 weeks ago

@shomarim No worries! I don't think the order should matter. Just have to test it and see if there is any problems. I'd say if anything Livewire should be after Flux (I have no idea about Filament).

shomarim commented 2 weeks ago

Thanks