Next.js Discord

Discord Forum

revalidatePath causes loss of focus

Unanswered
Toyger posted this in #help-forum
Open in Discord
Avatar
ToygerOP
I have a list of notes on /, and you can edit notes on /[id]. When a user makes textual changes, I call a server action (debounced) that updates the db, and calls revalidatePath('/') to make sure the list is updated. However, each time the server action is called, my cursor pointer is reset to the beginning of my contenteditable <div>, messing up my typing. The docs say "revalidatePath only invalidates the cache when the included path is next visited". I'm confused by this, because it is changing things on my current page.

1 Reply

Avatar
ToygerOP
Nevermind, my own bug. Think there's still some unexpected behaviour, but I'll repost my question more accurately after I investigate a little.