Skip to content

Commit 0cd40b7

Browse files
authored
invalidate -> update (#4793)
1 parent d5e9559 commit 0cd40b7

File tree

1 file changed

+1
-1
lines changed
  • site/content/tutorial/07-lifecycle/04-tick

1 file changed

+1
-1
lines changed

site/content/tutorial/07-lifecycle/04-tick/text.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: tick
44

55
The `tick` function is unlike other lifecycle functions in that you can call it any time, not just when the component first initialises. It returns a promise that resolves as soon as any pending state changes have been applied to the DOM (or immediately, if there are no pending state changes).
66

7-
When you invalidate component state in Svelte, it doesn't update the DOM immediately. Instead, it waits until the next *microtask* to see if there are any other changes that need to be applied, including in other components. Doing so avoids unnecessary work and allows the browser to batch things more effectively.
7+
When you update component state in Svelte, it doesn't update the DOM immediately. Instead, it waits until the next *microtask* to see if there are any other changes that need to be applied, including in other components. Doing so avoids unnecessary work and allows the browser to batch things more effectively.
88

99
You can see that behaviour in this example. Select a range of text and hit the tab key. Because the `<textarea>` value changes, the current selection is cleared and the cursor jumps, annoyingly, to the end. We can fix this by importing `tick`...
1010

0 commit comments

Comments
 (0)