Power-Components / livewire-powergrid

⚡ PowerGrid generates modern, powerful and easy-to-customize data tables using Laravel Livewire.

Home Page:https://livewire-powergrid.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting error when trying to cache views for pulse::no-results

akulmehta opened this issue · comments

Have you searched through other issues to see if your problem is already reported or has been fixed?

Yes, I did not find it.

Did you read the documentation?

Yes, I did not find it.

Have you tried to publish the views?

Yes - I didn't work.

Is there an error in the console?

Yes:

   InvalidArgumentException

  Unable to locate a class or view for component [pulse::no-results].

  at vendor\laravel\framework\src\Illuminate\View\Compilers\ComponentTagCompiler.php:311
    307▕         if (Str::startsWith($component, 'mail::')) {
    308▕             return $component;
    309▕         }
    310▕
  ➜ 311▕         throw new InvalidArgumentException(
    312▕             "Unable to locate a class or view for component [{$component}]."
    313▕         );
    314▕     }
    315▕

  1   vendor\laravel\framework\src\Illuminate\View\Compilers\ComponentTagCompiler.php:235
      Illuminate\View\Compilers\ComponentTagCompiler::componentClass("pulse::no-results")

  2   vendor\laravel\framework\src\Illuminate\View\Compilers\ComponentTagCompiler.php:220
      Illuminate\View\Compilers\ComponentTagCompiler::componentString("pulse::no-results", [])

PHP Version

8.2.12

PowerGrid

5.4.2

Laravel

10.46

Livewire

3.4.6

Alpine JS

3.13.5

Theme

Bootstrap

Describe the bug.

I have a Laravel application without Laravel Pulse and I have published the PowerGrid views. When I try to cache the views using php artisan view:cache I get the error in the console described above. I checked the code for the pulse component pulse::no-results and it seems it is only there in PowerGrid from all my dependencies, and specifically in resources/views/livewire/performance-card.blade.php

To Reproduce...

Install a Laravel application without pulse, and install PowerGrid and publish the views. Try running php artisan view:cache and it should produce the error.

Extra information

No response

Just checking if you are able to reproduce this and if there is any solutions for this?

Hello @akulmehta , It was caused by the view:cache command and not by publishing the views.
I fixed the problem by removing the blade file and transferring it to the livewire component

I upgraded to v5.4.4 and tried:

php artisan view:clear

php artisan view:cache

and I still get the error:

$ php artisan view:cache

   InvalidArgumentException 

  Unable to locate a class or view for component [pulse::no-results].

  at vendor\laravel\framework\src\Illuminate\View\Compilers\ComponentTagCompiler.php:311
    307▕         if (Str::startsWith($component, 'mail::')) {
    308▕             return $component;
    309▕         }
    310▕ 
  ➜ 311▕         throw new InvalidArgumentException(
    312▕             "Unable to locate a class or view for component [{$component}]."
    313▕         );
    314▕     }
    315▕

  1   vendor\laravel\framework\src\Illuminate\View\Compilers\ComponentTagCompiler.php:235
      Illuminate\View\Compilers\ComponentTagCompiler::componentClass("pulse::no-results")

  2   vendor\laravel\framework\src\Illuminate\View\Compilers\ComponentTagCompiler.php:220
      Illuminate\View\Compilers\ComponentTagCompiler::componentString("pulse::no-results", [])

What do you suggest?

Solution: I had to delete the following file which was in the published views:
resources/views/livewire/performance-card.blade.php