Skip to content

Comments

fix: FieldServiceProvider not registering assets with Nova (#4)#9

Merged
iamgerwin merged 2 commits intomainfrom
fix/issue-4-service-provider-registration
Nov 25, 2025
Merged

fix: FieldServiceProvider not registering assets with Nova (#4)#9
iamgerwin merged 2 commits intomainfrom
fix/issue-4-service-provider-registration

Conversation

@iamgerwin
Copy link
Owner

Summary

The Vue components were never being loaded because the FieldServiceProvider was not correctly registering the JavaScript assets with Nova.

Root Cause

The previous implementation used:

$this->app->resolving('Laravel\Nova\Nova', function ($nova): void {
    \Laravel\Nova\Nova::serving(function ($event): void {
        // ...
    });
});

This pattern doesn't work because Nova may already be resolved by the time this service provider boots.

Solution

Switched to the standard Nova asset registration pattern:

use Laravel\Nova\Events\ServingNova;
use Laravel\Nova\Nova;

Nova::serving(function (ServingNova $event): void {
    Nova::script('nova-dependency-container', __DIR__ . '/../dist/js/field.js');
    Nova::style('nova-dependency-container', __DIR__ . '/../dist/css/field.css');
});

Files Changed

File Changes
src/FieldServiceProvider.php Fixed asset registration pattern
CHANGELOG.md Added v1.0.10 entry
composer.json Version bump to 1.0.10
docs/flexible-field-support.md Updated version history

Test Plan

  • Verify [NovaDependencyContainer] logs appear in browser console
  • Verify dependency container works inside Flexible fields

Fixes #4

The previous $app->resolving() pattern was not correctly registering
the JavaScript assets with Nova, causing the Vue components to never
be loaded in the browser.

Switched to the standard Nova asset registration pattern:
- Import Laravel\Nova\Events\ServingNova
- Use Nova::serving() directly in boot()
@iamgerwin iamgerwin merged commit c83d55d into main Nov 25, 2025
1 of 5 checks passed
@iamgerwin iamgerwin deleted the fix/issue-4-service-provider-registration branch November 25, 2025 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NovaDependencyContainer inside Flexible field not showing dependent fields

1 participant