Refresh sub navigation after save

I have created an edit page for a Resource that should only show based on a field value. I am using the canAccess static method to check the value in the record and it works great, if the value is not valid and you try to access the page you get a 403 error and the sub-navigation item is added/removed accordingly but I need to manually refresh the page to actually see the change in the sub-navigation. Is there a way to force the sub-navigation to refresh after the form is saved to automatically add or remove the link to the page?
Solution:
Ok so the solution I've found for now is to overwrite the getRedirectUrl() method on the Edit class: ``` protected function getRedirectUrl(): ?string {...
Jump to solution
1 Reply
Solution
Abel Cobreros
Abel Cobreros6mo ago
Ok so the solution I've found for now is to overwrite the getRedirectUrl() method on the Edit class:
protected function getRedirectUrl(): ?string
{
// Reload page after save to make sure that the sub-navigation menu is
// reloaded to hide/display items depending on certain values.
return MemberResource::getUrl('edit', ['record' => $this->record]);
}
protected function getRedirectUrl(): ?string
{
// Reload page after save to make sure that the sub-navigation menu is
// reloaded to hide/display items depending on certain values.
return MemberResource::getUrl('edit', ['record' => $this->record]);
}
I just redirect to the same page the form I need to check is and it just works.
Want results from more Discord servers?
Add your server