Skip to content

api doc: explicitly tell set only works when the prop doesn't exist yet #1601

Closed
@JJPandari

Description

@JJPandari

Note: Here I'm all talking about a prop that doesn't exist in data in the first place.

The api says:

If the object is reactive, ensure the property is created as a reactive property and trigger view updates.

At least for me, it's not clear "does set work if the prop isn't in data, and I've already added it diredtly without set?". So I tried the source code and the comment made it clear:

Adds the new property and triggers change notification if the property doesn't already exist.

Then I altered my code to use set at prop addition and the not-properly-re-rendering problem was fixed.

So I think it may be better to explicitly tell in the api that set only works when the prop doesn't exist yet? Like the comment does?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions