NativePHP / laravel

Laravel wrapper for the NativePHP framework
https://nativephp.com
MIT License
3.13k stars 161 forks source link

Vendor view syntax fails to load vendor templates #188

Open secondmanveran opened 1 year ago

secondmanveran commented 1 year ago

What happened?

I have a simple todo app built in Livewire 3 with pagination. My app uses dark mode so I have to publish the Livewire pagination views in order to add support for dark mode.

As per the normal those views live at:

resources/views/vendor/livewire/

When loading a custom pagination template in Livewire pagination you have to pass the view to the links() method:

<div class="my-2">
  {{ $todos->links('livewire::tailwind') }}
</div>

When running this in a normal server via Valet or artisan serve this loads up the vendor template fine.

But when running in the NativePHP dev server these do not resolve and fall back to the Livewire default templates.

Curiously, it won't load the custom templates even if I move them out of the vendor directory, and even weirder, NativePHP will ONLY load the simple pagination template, even though simplePaginate is not being called, as you can see here:

public function render()
{
  $todos = Todo::latest()->where(
    'name', 'like', "%{$this->search}%"
  )->paginate(5);

  return view('livewire.todo-list', compact('todos'));
}

Very strange indeed.

How to reproduce the bug

When running under a normal PHP server pagination loads as expected, but under the NativePHP dev server only the default Livewire simple pagination templates are resolved.

Package Version

0.4.0

PHP Version

8.2.8

Laravel Version

10.19.0

Node Version

18.17.0

Which operating systems does with happen with?

macOS

Notes

macOS 13.14.1 (c)

simonhamp commented 5 months ago

I've seen something similar at times and I suspect that it's to do with view caching somewhere inside the native application's storage.

It may be that those caches aren't being cleared out properly when the app is rebuilt.

I will do some digging