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

Actually working wasm storage clear #58

Merged
merged 1 commit into from
Jul 26, 2024
Merged

Actually working wasm storage clear #58

merged 1 commit into from
Jul 26, 2024

Conversation

v-kat
Copy link

@v-kat v-kat commented Jul 25, 2024

The problem with wasm key deletion was also a shifting index. https://github.com/johanhelsing/bevy_pkv/blob/main/src/local_storage_store.rs#L96 was being called when the index was moved so any prior key deletions would mess up the index.
I switched to the much simpler clear api and made sure it was working on my bevy wasm project.

I should have tested #56 more.

@johanhelsing
Copy link
Owner

The downside with this is that it will delete any other things stored in local storage on the same domain.

@johanhelsing
Copy link
Owner

Also, could you explain what you mean by shifting index? I don't understand it

@v-kat v-kat closed this Jul 26, 2024
@v-kat v-kat reopened this Jul 26, 2024
@v-kat
Copy link
Author

v-kat commented Jul 26, 2024

The deletion loop starts with lower indexes which shifts the higher index keys as things are being deleted so not everything can be properly deleted as the indexes are off. I made a simpler change to fix the issue.

@johanhelsing
Copy link
Owner

Ah, nice catch. And fix 👍

@johanhelsing johanhelsing merged commit 30cca4b into johanhelsing:main Jul 26, 2024
16 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