Comments (5)
Potentially related to #111
from filament-fabricator.
I have the same problem and managed to get to the root of it.
The issue is in Z3d0X\FilamentFabricator\FilamentFabricatorServiceProvider
.
public function packageRegistered(): void
{
parent::packageRegistered();
$this->app->scoped('filament-fabricator', function () {
return new FilamentFabricatorManager();
});
}
Based on the https://laravel.com/docs/10.x/container#binding-scoped
The scoped method binds a class or interface into the container that should only be resolved one time within a given Laravel request / job lifecycle. While this method is similar to the singleton method, instances registered using the scoped method will be flushed whenever the Laravel application starts a new "lifecycle", such as when a Laravel Octane worker processes a new request or when a Laravel queue worker processes a new job:
Because filament-fabricator
is registered as scoped
it is flushed on every call. When it instantiates new FilamentFabricatorManager
this is what happens in the constructor
public function __construct()
{
/** @var Collection<string,string> */
$pageBlocks = collect([]);
/** @var Collection<string,string> */
$layouts = collect([]);
$this->pageBlocks = $pageBlocks;
$this->layouts = $layouts;
}
meaning all previously registered page blocks and layouts will be overwritten by empty collections (removed).
Now this would be fine if bootingPackage()
method from Z3d0X\FilamentFabricator\FilamentFabricatorServiceProvider
is called, but this happens only once.
This will eventually result in having page blocks and layouts visible on first and N-1 subsequent requests (N = number of workers that you are running octane with), but on the N+1 request they will simply disappear and be gone until you restart octane server.
Solution to this problem is simply changing scoped
with singleton
but I am not 100% sure of the full implications this might have on the package.
public function packageRegistered(): void
{
parent::packageRegistered();
$this->app->singleton('filament-fabricator', function () {
return new FilamentFabricatorManager();
});
}
What was the reason of going with scoped
instead of singleton
in the first place @Z3d0X?
from filament-fabricator.
I don't think there was any specific reason for going with scoped
instead of singleton
.
If singleton
works let's change to that. Thanks for investigating this issue.
from filament-fabricator.
@Z3d0X any idea when this will be tagged?
from filament-fabricator.
v2.0.6
Released with #130
from filament-fabricator.
Related Issues (20)
- Layout "default" not found
- Layout not found when using artisan queue:work HOT 6
- PageResource fix deprecation
- How to add multiple page models HOT 1
- It block all artisan commands in docker HOT 4
- Duplicates in cluster navigation HOT 2
- Slug unique `integrity constraint violation`
- Builder Blocks are instantiated during registration HOT 1
- Deleted Block will make a page unrenderable HOT 2
- Cache issue HOT 3
- Session empty on Fabricator Pages HOT 1
- Translatable Resource Labels HOT 1
- Undefined array key "data" HOT 2
- Draft Pages HOT 2
- Localization Support HOT 8
- Lazy loading violation on Subpages in strict mode HOT 2
- Unable to install V2 of this package with Filament 3.x HOT 4
- [Documentation]: Schema Slots Feature HOT 7
- Issue with Laravel Jetstream HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filament-fabricator.