Repository navigation
Publish Filament assets on every composer install - #398
Merged
Merged
Conversation
filament:upgrade only ran on composer update, so deployments using composer install kept serving the previously published Filament JS. The stale schemas.js lacks the exposed schema component methods that Filament 5.11 renders, which breaks markdown editor image uploads with "$saveUploadedFileAttachmentAndGetUrl is not defined". Move it to post-autoload-dump, as the Filament deployment docs advise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #396
Problem
Uploading an image in the markdown editor fails with:
The code is fine; the published Filament JS on the server is stale.
public/js/filamentis gitignored and only gets republished byfilament:upgrade/filament:assets. In this repofilament:upgradewas only inpost-update-cmd, which runs oncomposer update, not on thecomposer installthat deployments use.On roadmap.ploi.io,
js/filament/schemas/schemas.jsis still the build from 25 Oct (4015 bytes). That version offilamentSchemaComponentdoesn't expose schema component methods, while Filament 5.11 renders the markdown editor calling$saveUploadedFileAttachmentAndGetUrl(). The?v=5.11.0.0query string comes from the installed composer version, not the file contents, so the old file looks current.support.js,notifications.jsandtabs.jsare also out of date there.Fix
Move
@php artisan filament:upgradefrompost-update-cmdtopost-autoload-dump, as the Filament deployment docs recommend. Everycomposer installnow republishes the assets.Verification
Tested locally in the browser as an admin:
schemas.jsswapped in locally, the upload throws exactly the error from the issue.composer dump-autoload, the file is republished from vendor and the upload works again.After merging
The next deploy fixes production. To fix it right away, run
php artisan filament:assetson the server.roadmap:upgradealso callsfilament:assets, but as its last step, after the migrations. So the deploy either doesn't run it or stopped before that step. The deploy log is worth checking.