Is Dashboard a livewire component?
Dashboard is a Page, right? Which means its a livewire component. Why cant I pass values to the blade file?
40 Replies
Is you livewire view using the filament page component.?
yes its is!
Better question why are you defining a view property and a render method?
Livewire doesn’t know what to do
They are part of the same thing and you’re just confusing it.
Because I went to the BasePage and that render() had defined a View property
Yea but your overriding it. You don’t need to do that.
The view property says to render that view. But then you’re telling it to ignore you view property and try to render a different view that it can’t find.
Use one or the other, not both.
So I should just keep it like this?
If you make users a property on the livewire component then you don’t have to pass it. But I can’t recommend one or the other without understanding the actual use case.
Neither are wrong. It depends on the use case and what should be exposed publicly. But you can’t use both methodologies at the same time.
Basically what I want to do is fetch some data periodically (like every 2s) and display it on the widget.
Like a function that will run every 2s and output something
Widgets have a polling setting.
They are their own livewire components. Sounds like you need to focus on the widget and less on the page.
is polling only done for the getStats() function?
Widgets don’t have state.?
not state, getStats()
Forms have state
Sorry, my bad. Misread that.
Haha, no problem
But yea. Widgets have their own polling .
I understand, but do they only poll from getStats()?
When you poll the widget will re-evaluate itself.
They don’t poll from getStats. Polling tells live wire to rerun the component meaning getStats will get processed on each polling interval and dom diffed to the widget.
In livewire, polling basically refreshes the livewire component.
Should I have something to return?
Understandable
Not to say there may or may not be caveats in that depending on the hydration lifecycle of the component but that boils down to your understanding of livewire and how to apply it’s lifecycle hooks. But in this case Stats should respect the polling lifecycle and re-render appropriately without you needing to intervene.
As it is now, the doesnt show anything
Yeah Im still trying very hard to understand how livewire works.
You’re doing too much. Music widget should be extending StatsWidget in this case.
Wait misread that too. Sorry.
But docs do the same
Ah oke
Only thing standing out to me in that code is that your returning a hard coded value to the Stat. So it’ll never change .
Yes of course, but its not even rendering 😅
Can you share a repo. Feel like something might be off at a higher level. Feel free to DM me if you don’t want to share it publicly.
Sure. But the repo is private haha
You can add me and then delete me after the issue is resolved. I won’t be mad lol.
Just trying to help, but it’s your call. 🙂
yaah I know. In my mind I didnt know if you were going to be ok with sharing your email so I can add you but then I remembered that you have your own public repos 🤣
Hard to help sometimes without a more wholistic view sometimes.
Yeahh very understandable
Gimme a few
I’m a visual learner. Lol.
If it’s private you can just add me as a contributor with my GitHub username.
I’m really good at debugging. Not so great at guessing.
How can I invite you sir? I cant find you by adamweston
ah its just awcodes. Im just overcomplicating it
I have sent you an invite
Will look at it tomorrow. Getting late here. Hang in there. Will help soon.
Understandable. Thank you:)
Goodnight. Its 3am here 😅
Ugh. Go to sleep. It’s 9:25 here. Also known as clock out. We’ll get it resolved. Just not tonight. Have a good one.
I created a new project and I have the same issue. There might be a small chance that there is something going on with filament-widgets, but will have a look tomorrow as well
Could be. It’s possible.
Could it be that Im specifying a view path? Im pretty sure the path is the the blade file is correct. But in the docs there is no
$view
Its just using the default view.
I got it working! Turns out mistakes were pretty easy to spot after a good night's sleep 😅