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

Remove notes before triggering cache invalidation #60

Merged
merged 1 commit into from
Dec 8, 2024
Merged

Conversation

lynn
Copy link
Contributor

@lynn lynn commented Dec 8, 2024

Should fix the issue reported by taq in #toashuaq here.

Calling emitter.emit('removenote') before doing word.notes = keep means the removed note is still attached to the word when this code in search.ts recomputes the cache entry:

for (let k of ['vote', 'note', 'removenote', 'edit', 'move'])
	emitter.on(k, (_, entry) =>
		cache.splice(cached_index(entry.id), 1, cacheify(entry)),
	);

and then the removed note is still in the cache when answering a search query.

Copy link
Collaborator

@uakci uakci left a comment

Choose a reason for hiding this comment

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

lgtm :33 and thank you!

@lynn lynn merged commit 24d3d6b into main Dec 8, 2024
1 check passed
@lynn lynn deleted the lynn/note-cache-fix branch December 8, 2024 21:53
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