-
Notifications
You must be signed in to change notification settings - Fork 26
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
Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization #21
Comments
Sorry, it's impossible to debug this without any code. What's the form schema for this? |
|
That's the User model. Can you please share the form of your UserResource? |
class UserResource extends Resource
} |
same here, using filament v2 |
It's not related to the data but to the form structure. It tries to get the name from the components and fails while accessing one of them. I guess it's a Section or Repeater or similar |
Hey @pxlrbt . I also have the same problem and I can share a very minimalist sequence of steps to reproduce the problem. Let's assume a UserResource with at least 2 textinput ( 'email' and 'name') and ListUserActivities are in place.
return $form
->schema([
Forms\Components\TextInput::make('email')
->live(),
Forms\Components\Group::make()
->schema(function (Forms\Get $get): array {
return $get('email')
? [
Forms\Components\TextInput::make('name'),
]
: [];
}),
]);
return $form
->schema([
Forms\Components\Section::make(__('User'))
->schema([
Forms\Components\TextInput::make('email')
->live(),
Forms\Components\Group::make()
->schema(function (Forms\Get $get): array { // throw error
return $get('email')
? [
Forms\Components\TextInput::make('name'),
]
: [];
}),
]),
]);
I hope this helps in resolving the issue, or at least pointing out steps for accurately reproducing the error. |
I have the same error in v3 |
Hi, I was checking the @fcno theory, then I made a test, I'm using the plugin https://filamentphp.com/plugins/bezhansalleh-shield for roles, so I've changed So maybe the problem is in the Form components configuration or construction. |
Same problem here, I've got a Section in my form and some dependent fields. Doesn't work at all. |
@pxlrbt It seems that this problem has gone away. I think that some update to the filament core ended up reflexively correcting the problem here. I'm currently using version 3.2.17 of filament. As this part of my code was commented out for a long time, I can't say which version of the filament ended up correcting the problem. @Ray-vV Can u share your code and the filament version? try to use the latest version to see if the problem is gone. |
Hm, interesting. I think there might still be issues with Sections or other Layout fields 🤔 |
Thanks for the suggestion, I decided to switch to the z3d0x/filament-logger for now. Not necesarrily due to this error however. But it turned out the z3d0x package was already more in the direction of what I wanted to implement into my project. |
Unfortunately the problem is still here. And yes, changing CheckboxList to Select solves the problem. |
Same. Sorry. |
I had similar problem, so i fixed it by this code (I overwrite createFieldLabelMap method):
|
I encountered the error "Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization"
while using Filament v3.0-stable and PHP 8.1.
The text was updated successfully, but these errors were encountered: