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

feat(guide/computed): add previous to computed #3001

Merged
merged 5 commits into from
Sep 27, 2024

Conversation

ferferga
Copy link
Contributor

@ferferga ferferga commented Sep 6, 2024

This was shipped silently in Vue 3.4. See PR

Signed-off-by: GitHub <noreply@github.com>
Copy link

netlify bot commented Sep 6, 2024

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit 43567d9
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/66f6da69748676000826771a
😎 Deploy Preview https://deploy-preview-3001--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

// When count is >=4, the last value that fulfilled our condition will be returned
// instead until count is less or equal to 3
alwaysSmall(previous) {
if (this.count >= 3) {
Copy link
Member

Choose a reason for hiding this comment

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

question: should this be <=3 according to the explanation above?

// When count is >=4, the last value that fulfilled our condition will be returned
// instead until count is less or equal to 3
const alwaysSmall = computed((previous) => {
if (count.value >= 3) {
Copy link
Member

Choose a reason for hiding this comment

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

Same note about <=3

@ferferga
Copy link
Contributor Author

Good catch @NataliaTepluhina! Changed the logic a few times while working on this because I wasn't convinced in the examples that I was providing and completely missed this!

I also added the closing </script> tag that was missing from one of the Composition API's examples in my last commit.

@NataliaTepluhina
Copy link
Member

Thank you @ferferga! I've updated also the examples for writable computeds and I think we're good to go now

@NataliaTepluhina NataliaTepluhina merged commit 4567e55 into vuejs:main Sep 27, 2024
5 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.

2 participants