Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: State properties #78

Merged
merged 2 commits into from
Nov 23, 2023
Merged

fix: State properties #78

merged 2 commits into from
Nov 23, 2023

Conversation

lee-to
Copy link
Contributor

@lee-to lee-to commented Nov 23, 2023

Hi there! I found a bug. If the states contain an element without a key and an element with a key, an error will occur and a component with a numeric property will be generated. my pr fixes this case

Example:

state(['article', 'count' => 0]);

I'll get an error

syntax error, unexpected token "$", expecting variable

Generated component

new class extends Component implements Livewire\Volt\Contracts\FunctionalComponent
{
    public static CompileContext $__context;

    use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

    public $0;

    public $count;

public $0;

@nunomaduro nunomaduro marked this pull request as draft November 23, 2023 15:51
@nunomaduro
Copy link
Collaborator

@lee-to Can you add tests to this?

@lee-to
Copy link
Contributor Author

lee-to commented Nov 23, 2023

@lee-to Can you add tests to this?

Yes, sure

@lee-to lee-to marked this pull request as ready for review November 23, 2023 16:33
@taylorotwell taylorotwell merged commit 66a44a2 into livewire:main Nov 23, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants