-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Tenant Pages Livewire Component Error #12837
Labels
Comments
In Livewire ComponentRegistry.php the function protected function nameToClass($name)
{
// Check the aliases...
if (isset($this->aliases[$name])) {
if (is_object($this->aliases[$name])) return $this->aliases[$name]::class;
return $this->aliases[$name];
}
// Hash check the non-aliased classes...
foreach ($this->nonAliasedClasses as $class) {
if (crc32($class) === $name) {
return $class;
}
}
$generatedClass = $this->generateClassFromName($name);
/*
* This prevents submission issues on Filament Tenant Pages.
* No idea why ?
* Maybe the page component is not registered correctly hence why livewire cant find the proper class and adds the App\Livewire\ at the front
*
* Although this doesn't fix the issue itself its just the reason for the error.
* The source has top be somewhere higher up the chain.
* */
if(str_starts_with($generatedClass, "\App\Livewire\App\Filament\Pages")) {
$generatedClass = str_replace("\App\Livewire\App", 'App', $generatedClass);
}
// Reverse generate a class from a name...
return $generatedClass;
} The above code is the reason why livewire throws an exception. It can't find the component classes. In FilamentPHP HasComponents.php the function // This works and was there already
if ($this->hasLogin() && is_subclass_of($loginRouteAction = $this->getLoginRouteAction(), Component::class)) {
$this->queueLivewireComponentForRegistration($loginRouteAction);
}
/*
* The following three checks / registrations are missing right now. Seems so few people actually use this feature that nobody noticed you can't actually use it the intended way ^^
*
* I will be making a PR for these 6 lines. I dont think it will break anything but who knows ^^
* */
if ($this->hasTenantRegistration() && is_subclass_of($tenantRegistrationComponent = $this->getTenantRegistrationPage(), Component::class)) {
$this->queueLivewireComponentForRegistration($tenantRegistrationComponent);
}
if ($this->hasTenantProfile() && is_subclass_of($tenantProfileComponent = $this->getTenantProfilePage(), Component::class)) {
$this->queueLivewireComponentForRegistration($tenantProfileComponent);
}
if ($this->hasProfile() && is_subclass_of($profilePageComponent = $this->getProfilePage(), Component::class)) {
$this->queueLivewireComponentForRegistration($profilePageComponent);
} |
dev-idkwhoami
added a commit
to dev-idkwhoami/filament
that referenced
this issue
May 17, 2024
…ent if necessary. This PR is in response to issue filamentphp#12837
dev-idkwhoami
added a commit
to dev-idkwhoami/filament
that referenced
this issue
May 17, 2024
…ent if necessary. This PR is in response to issue filamentphp#12837
Merged
3 tasks
Merged
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Package
filament/filament
Package Version
v3.2.80
Laravel Version
v11.7.0
Livewire Version
v^3.4.10
PHP Version
PHP 8.3.6
Problem description
When trying to submit a form on a tenant page it throws a
ComponentNotFoundException
and tries to render a view that just doesn't exist.Expected behavior
The form submission should run the appropiate functions without exception.
Steps to reproduce
Clone the Reproduction repo then run the following commands
Here are the examples and how to replicate the problem:
Non-Plugin Tenant Profile Page
$APP_URL/nonplugin
login if not already done. In the top left expand tenant dropdown menu and click onNon Plugin Profile
Save changes
and error will be thrown.Plugin Tenant Profile Page
$APP_URL/admin
login if not already done. In the top left expand tenant dropdown menu and click onPlugin Profile
Save changes
and error will be thrown.Non Plugin Tenant Registration Page
$APP_URL/nonplugin/new
login if not already done.Non Plugin Register
and an error will be thrown.Reproduction repository
https://github.com/dev-idkwhoami/filament-livewire-form-on-tenant-profile-page
Relevant log output
No response
The text was updated successfully, but these errors were encountered: