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

[docs] Add clarification about reactivity and arrays #6547

Merged
merged 4 commits into from
Jul 23, 2021
Merged

[docs] Add clarification about reactivity and arrays #6547

merged 4 commits into from
Jul 23, 2021

Conversation

stephane-vanraes
Copy link
Contributor

Because this is a common recurring question, this PR adds a touch more information in regards to reactivity and arrays. More specifically the need for an assignment after array manipulation.

This is already covered in the tutorial, but it seems good to also include it as an example directly in the docs themselves.

Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thank you! I would move the example what does and what doesnt trigger the update into the existing code block

site/content/docs/01-component-format.md Outdated Show resolved Hide resolved
@stephane-vanraes
Copy link
Contributor Author

I am not sure about moving it in the same block, I think keeping them separate avoids confusion because it makes the distinction betweeen the normal way and the special case

@benmccann benmccann changed the title Add clarification about reactivity and arrays [docs] Add clarification about reactivity and arrays Jul 20, 2021
// this method call does not trigger an update
arr.push(2);
// this assignment will trigger an update
// if the markup references `arr`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should go on the previous line? it's sort of a short line break. Probably fine either way though

@stephane-vanraes
Copy link
Contributor Author

Fixed the language following Ben's comment.
Moved the array text and sample to their own 'row' so that it's clearer which part of the text belongs to each code block.

@benmccann benmccann merged commit 63f592e into sveltejs:master Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants