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: Fixed TODO id in animation tutorial #1108

Merged
merged 3 commits into from
Jan 13, 2025

Conversation

F2
Copy link
Contributor

@F2 F2 commented Jan 12, 2025

The tutorial on advanced animations (see this and this) is using todo.id without ever defining id.

For example, in TodoList.svelte, it says:

<li
  class={{ done: todo.done }}
  in:receive={{ key: todo.id }}
  out:send={{ key: todo.id }}
>

However, the todos are defined in App.svelte like this:

const todos = $state([
  { done: false, description: 'write some docs' },
  { done: false, description: 'start writing blog post' },
  { done: true, description: 'buy some milk' },
  { done: false, description: 'mow the lawn' },
  { done: false, description: 'feed the turtle' },
  { done: false, description: 'fix some bugs' }
]);

This PR adds the id to the todos, and also uses the id as the key in the #each loop.

Incrementing the id for new todos could be done in many ways, but I chose the uid++ way to be consistent with this example.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time.
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.

Copy link

vercel bot commented Jan 12, 2025

@F2 is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

@F2 F2 changed the title docs: Fixed animation id in tutorial docs: Fixed TODO id in animation tutorial Jan 12, 2025
@F2 F2 marked this pull request as ready for review January 12, 2025 22:59
Copy link

vercel bot commented Jan 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
svelte-dev ✅ Ready (Inspect) Visit Preview Jan 13, 2025 8:20am

Copy link
Member

@eltigerchino eltigerchino left a comment

Choose a reason for hiding this comment

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

Thank you!

@eltigerchino eltigerchino merged commit 8422db4 into sveltejs:main Jan 13, 2025
4 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