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

fix: reactive storage infinite loop #181

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

gxr404
Copy link
Contributor

@gxr404 gxr404 commented Jun 25, 2024

Description

Multiple triggering of reactive data updates by the same function interspersed with asynchronous functions.
Causing multiple triggers of the watch function in a short period of time

Linked Issues

@tmkx tmkx changed the title fix: Reactive storage infinite loop fix: reactive storage infinite loop Jun 25, 2024
@tmkx tmkx merged commit 3708104 into antfu-collective:main Jun 25, 2024
@@ -132,7 +132,14 @@ export function useWebExtensionStorage<T>(
data,
async () => {
try {
await (data.value == null ? storageInterface.removeItem(key) : storageInterface.setItem(key, await serializer.write(data.value)))
if (data.value == null) {
storageInterface.removeItem(key)
Copy link

Choose a reason for hiding this comment

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

Noticed that promises no longer get awaited. Not sure how big of a deal that is.

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.

3 participants