dcasia / nova-dashboard

The missing dashboard for Laravel Nova!
MIT License
69 stars 10 forks source link

Navigation state doesn't update #76

Open nickstewart95 opened 5 months ago

nickstewart95 commented 5 months ago

For my Nova menu, I have a section called Reports with two dashboards inside of it

MenuSection::make('Reports', [
    MenuItem::dashboard(Demographics::class),
    MenuItem::dashboard(Statistics::class),
])->icon('document-report'),

Anytime I click from one of those dashboards links to any other item in the menu, the menu state doesn't change. This is limited to just these two dashboards... If I remove the NovaDashboard card from each dashboard, the issue resolves itself, so I figured it something to do with NovaDashboard,

Ex dashboard

class Demographics extends Dashboard
{
    public function name()
    {
        return 'Demographics';
    }

    public function cards()
    {
        return [
            NovaDashboard::make()
                ->addView('Demographics Filters', function (View $view) {
                    $view->static();

                    return $view
                        ->icon('window')
                        ->addWidgets([
                            GenderWidget::make()->layout(4, 2, 9, 0),
                        ])
                        ->addFilters([
                            Gender::make(),
                            Status::make(),
                            Year::make(),
                        ]);
                }),
        ];
    }

    public function uriKey()
    {
        return 'demographics';
    }
}

Demo

https://github.com/dcasia/nova-dashboard/assets/7912584/28cf39e2-5460-4414-ba21-be1f065b99ec

It doesn't show in the demo, but the new page loads with no issues after each click

mlordi commented 5 months ago

Same in addition to the menu not working on mobile. It will not pull out the menu to click on any links.

milewski commented 5 months ago

I tracked the issue down to these 2 lines:

https://github.com/dcasia/nova-dashboard/blob/03b1ee3bfa46bdc00b6c7a03aaf960f0bfe8727b/resources/js/components/Card.vue#L72-L73

If feels like it is a bug in nova itself not on this package...

davidbankes commented 5 months ago

@milewski

It does not appear to me to be a bug in nova itself.

To test, I created an app with four dashboards. Two vanilla nova dashboard, and two DigitalCreative dashboards. I can navigate back and forth between the two vanilla ones just fine, but as soon as I navigate to a digital creative one, navigation ceases to update when navigating between any of the dashboards.

I don't know that that is conclusive. There could be something funny going on with my Dashboards that I can't figure out, but it seems to me it is most likely an issue with this package.

milewski commented 5 months ago

Yeah, but what I meant was as soon as I register some new items into the nova store, it bugs out the menu.. It makes no sense by modifying the store it affects the menu that's why I said it probably an nova issue, they might be doing something that brakes when the manipulating the store manually

mlordi commented 5 months ago

Is this possibly the same issue that is causing the mobile menu not to work? I would love to deploy all the hard work I put into using your widgets but without the mobile menu I can't. A lot of my users are accessing the project that way. Thanks milewski for your help and the PR for adding the canSee feature is working excellent btw!