You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, Injector injects dependencies via the singleton model, and thus caches the result of ItemRequestFactory::create. This means that if you have navigated multiple GridFields deep, every action still receives the GridFieldDetailForm_ItemRequest of the very top GridField.
The actions of every GridField nested underneath another gridfield thus all get the incorrect links, which can be seen by clicking the next or back button, which directs you all the way back to viewing the items of the top level GridField.
There doesn't seem to be any way to tell Injector to inject dependencies without caching as far as I can see. A different approach will probably have to be taken.
I'm not sure if it's the correct solution, but the timing works out such that placing $this->gridFieldRequest = BetterButtons::getGridFieldRequest(); in Action::__construct results in every action receiving the correct ItemRequest.
The text was updated successfully, but these errors were encountered:
In the SilverStripe 4 branch, Actions receive their gridFieldRequest via Injector by asking for
However,
Injector
injects dependencies via the singleton model, and thus caches the result ofItemRequestFactory::create
. This means that if you have navigated multiple GridFields deep, every action still receives theGridFieldDetailForm_ItemRequest
of the very top GridField.The actions of every GridField nested underneath another gridfield thus all get the incorrect links, which can be seen by clicking the next or back button, which directs you all the way back to viewing the items of the top level GridField.
There doesn't seem to be any way to tell Injector to inject dependencies without caching as far as I can see. A different approach will probably have to be taken.
I'm not sure if it's the correct solution, but the timing works out such that placing
$this->gridFieldRequest = BetterButtons::getGridFieldRequest();
inAction::__construct
results in every action receiving the correct ItemRequest.The text was updated successfully, but these errors were encountered: