livewire / volt

Volt is an elegantly crafted functional API for Livewire.
https://livewire.laravel.com/docs/volt
MIT License
312 stars 19 forks source link

Filenames with hyphens "-" #91

Closed djoks closed 3 months ago

djoks commented 5 months ago

Volt Version

1.6

Laravel Version

10.10

PHP Version

8.3.1

Database Driver & Version

No response

Description

I do not know if this has already been mentioned however I struggled getting my volt component to work, my file name "location-picker" seemed to be the cause. My methods were not recognized and neither were some other features I was expecting to work. Also I was any to use props within my component.

I do not see any mention of this in the docs about filenames not supposed to have hyphens.

Steps To Reproduce

Create a simple volt component with a hyphen in its name. eg. "example-picker.blade.php" Create some state values and methods. Try accessing them from the view. Try displaying the value of any one of the components props.

inmanturbo commented 5 months ago

Have you gotten any other components working in your app, or is it just the one?

djoks commented 5 months ago

Have you gotten any other components working in your app, or is it just the one?

So I created a new component with the exact same code but without a hyphen in the file name and it worked perfectly.

driesvints commented 5 months ago

Heya, thanks for reporting.

We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here? Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.

laravel new bug-report --github="--public"

Please do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.

Thanks!

nunomaduro commented 5 months ago

Volt's internal test suite contains dozens of components with hyphens, and they are working as expected. Can you follow @driesvints's instructions to create a reproduceable scenario please?

Screenshot 2024-02-12 at 09 21 26
nunomaduro commented 3 months ago

Closing this issue due to the lack of activity.