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

Collision with component name property for render method view #130

Closed
faustbrian opened this issue Aug 6, 2019 · 2 comments

Comments

@faustbrian
Copy link
Contributor

commented Aug 6, 2019

8d0137f#diff-c694a29ec41709ca1a5f5e8a29f6467eR45

This line performs a check to either use the $this->name property or build a name from the class name. This results in a collision with components that have a property called name like contact forms or user editing forms.

<?php

namespace App\Http\Livewire;

use Livewire\Component;

class UpdateContactInformation extends Component
{
    /** @var string */
    public $name;
}

With this code you can start typing in a name in an input and an error modal will pop up that will tell you something to the effect of View [value of $name] doesn't exist.

My first idea for a solution would be to create a method like getName() that developers can use to apply a custom name to their component instead of relying on a base $name property which will commonly be overwritten by various components.

@faustbrian faustbrian changed the title Collision with component name property for render method Collision with component name property for render method view Aug 6, 2019

@calebporzio

This comment has been minimized.

Copy link
Owner

commented Aug 6, 2019

I think that's a great solution - is this something that you could PR?

@faustbrian

This comment has been minimized.

Copy link
Contributor Author

commented Aug 6, 2019

Done in #131

@calebporzio calebporzio closed this Aug 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.