ViewParameter not beeing parsed in Action::make (Solved: Dev-Error!)

Hey folks - I ain't sure if this is a bug or if I am not seeing something (again). Given I got the following blade-view: https://gist.github.com/Husky110/c80783ec21915de92e9f36ff6c017369 (Note - I'm using flowbite) And given I have the following function on my page:
protected function getActions(): array
{
return [
Action::make('documentation')
->view('components.my-components.general.documentation-drawer', [
'documentationHeadline' => 'MEEPERS',
'viewToRender' => 'components.mystuff.anotherviewpath'
])
];
}
protected function getActions(): array
{
return [
Action::make('documentation')
->view('components.my-components.general.documentation-drawer', [
'documentationHeadline' => 'MEEPERS',
'viewToRender' => 'components.mystuff.anotherviewpath'
])
];
}
I should have a top-drawer that echos $viewToRender -> instead I'm getting Undefined variable $viewToRender. Interestingly enough - $documentationHeadline is beeing parsed just fine and if I remove $viewToRender from my blade-file, it works just fine. If there is a typo - I don't see it. Can someone please investigate this - if there might be a general problem?
Gist
documentation-drawer
documentation-drawer. GitHub Gist: instantly share code, notes, and snippets.
32 Replies
Husky110
Husky11013mo ago
P.S.: When I include the view through another blade-view like @include('components.my-components.general.documentation-drawer', ['documentationHeadline' => 'MEEPERS', 'viewToRender' => 'PIEP']) it works fine. That leads me to believe that there might be a bug... @Dan Harrin - can you take a look at this please? 🙂
Dan Harrin
Dan Harrin13mo ago
I copied your code into my app and it worked first try without any modifications please check you're looking at the correct page, check your view cache, etc check the domain of the app you're looking at esp since $documentationHeadline is working for you, there must be something simple wrong
Husky110
Husky11013mo ago
Okay - good news: After clearing the cache the error seems to have gone. Now to the bad news - the page itself does not show any button... in fact: the action itself is not even beeing rendered. (I made sure I'm on the right page.) This is the page-code:
<x-filament::page>
@include('components.my-pages.rules')
<form wire:submit.prevent="submit">
{{ $this->form }}
</form>
</x-filament::page>
<x-filament::page>
@include('components.my-pages.rules')
<form wire:submit.prevent="submit">
{{ $this->form }}
</form>
</x-filament::page>
Pretty sure I'm missing a $this->actions or somewhat...
Dan Harrin
Dan Harrin13mo ago
it didnt show any button for me either so it could just be a problem with your view you dont need to include actions anywhere, thats what <x-filament::page> does
Husky110
Husky11013mo ago
but that would have thrown an error... (I guess)
Dan Harrin
Dan Harrin13mo ago
check the html that is being rendered
Husky110
Husky11013mo ago
And I made sure that I'm on the right page, by editing a section-headline which had been changed. I did already - there should be the data-drawer-target="documentation-drawer" somewhere, but it isn't.
Dan Harrin
Dan Harrin13mo ago
what is in the place of where the actions should be?
Husky110
Husky11013mo ago
Nothing appearently... o.O
Dan Harrin
Dan Harrin13mo ago
remove ->view(), does it render?
Husky110
Husky11013mo ago
Nope
Dan Harrin
Dan Harrin13mo ago
im not sure then. sorry
Husky110
Husky11013mo ago
I am - I'm using getHeader() to render a view with a sub-headline.
Dan Harrin
Dan Harrin13mo ago
thats the problem
Husky110
Husky11013mo ago
And that seems to overwrite the actions - can I implement them in there somehow?
Dan Harrin
Dan Harrin13mo ago
it replaces the entire header inc actions
Husky110
Husky11013mo ago
figured... is there a $this->actions or somewhat I could call inside the header-view?
Dan Harrin
Dan Harrin13mo ago
<x-filament::pages.actions :actions="$this->getCachedActions()" />
Husky110
Husky11013mo ago
god damned - I took the complete wrong approach... had to use getSubheading for what I wanted and now the actions work again. even the component is working now. Please upgrade the docs for knuckle-heads like me... It would be really great to have some overview of the functions I can call within a page and their effects. Right now that has to be done by "reading code" inside my IDE. And while the current docs are great to get the ropes of filament when you start a new, they are a bit blurry for someone that is transitioning (or trying to upgrade). Like for example the getSubheading-function. That thing is not even documented (well - at least when you search for it...). I don't wanna know how many of my "help"-threads were viewed like "how daft is this dude?" where in the end I just had no idea where to look for what I needed.
Dan Harrin
Dan Harrin13mo ago
GitHub
filament/packages/panels/docs/04-pages.md at 3.x · filamentphp/fila...
Admin panel, form builder and table builder for Laravel. Built with the TALL stack. Designed for humans. - filament/packages/panels/docs/04-pages.md at 3.x · filamentphp/filament
Dan Harrin
Dan Harrin13mo ago
i have done my best to fill the gaps in v3, but theres never gonna be a situation where every single method is documented because there are so many, using your IDE is kinda part of the job with Filament to explore how to customize things but i do understand
Husky110
Husky11013mo ago
Maybe I can suggest something here! Plain old PHP-Docs! I used something called phpDocumentor (see https://www.phpdoc.org/ ) before. That thing just extracts your PHP-Docs from your code and creates a simple function-based documentation. Maybe adding this as a separate addition to the main-docs would be an idea. 🙂
Home
Documentation Generator for PHP
Dan Harrin
Dan Harrin13mo ago
yeah I think Laravel does that too personally I dont see the benefit over using your IDE though, as your IDE also shows you your implementation etc?
Husky110
Husky11013mo ago
yes and no. I am using PHPStorm and whilst that is considered to be a great IDE, as soon as your project gets too abstract, it will basically crumble right in front of you with loadingtimes up to 5 Minutes for autocompletion. (loads of lambda- and anonymous-functions have that effect) so my IDE is sort of a friend, but not one that can be counted on. and while it can be considered that I am running it on a Steam Deck, I ran it on a HP-Omen-Laptop (from 2018) with an Intel i7-8750H with the same effect.
toeknee
toeknee13mo ago
So you will always get that level of issue with standard PC's indexing tens of thousands of files. I use phpStorm on a mac M1 and an M2 and it never slows down one bit. I usually have 4 projects open and indexed at anyone time.
Husky110
Husky11013mo ago
What drives me nuts is that the issue itself is known to JetBrains but they just can't or won't solve it. But I don't wanna pour crap over them, since in general their products are great. In general I think that Filament would profit from enhancing the docs on that part.
toeknee
toeknee13mo ago
I don't think it's that they won't they have made massive improvements. But it's a tricky scenario, you are reading tens of thousands of files, and windows is naturally very slow at doing that. Have you increases your memory allocation?
Husky110
Husky11013mo ago
I'm running on Linux and yes. 🙂
toeknee
toeknee13mo ago
Ohh I never really got slow downs there, how stange!
Husky110
Husky11013mo ago
And tens of thousand files... Well... 😅 More like houndreds of thousands... (almost 270k in my case) 😅 - What dies down mostly is the code-completion, since it seems to try to run up the path to the source and indexing seems to help not much there.
toeknee
toeknee13mo ago
I was being reserved haha.... yeah, maybe submit another bug report. But I doubt they have a big team on the linux side.
Husky110
Husky11013mo ago
shouldn't be a problem, since we're talking about java...