Skip to content

Make clearing local data also clear the attachment cache (#191).#193

Merged
leplatrem merged 1 commit intomozilla-extensions:masterfrom
Standard8:clear-all
Apr 19, 2024
Merged

Make clearing local data also clear the attachment cache (#191).#193
leplatrem merged 1 commit intomozilla-extensions:masterfrom
Standard8:clear-all

Conversation

@Standard8
Copy link
Contributor

This calls attachments.prune() after clearing the database, which will remove all the attachments as there's no references in the database and so it will think they have all expired.

await (await client.openCollection()).clear();
} else {
await client.db.clear();
await client.attachments.prune([]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: the empty array is required, as otherwise the call fails due to calling .includes() on an undefined value.

Copy link
Contributor

@leplatrem leplatrem left a comment

Choose a reason for hiding this comment

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

Pruning was introduced in Fx 110 https://bugzilla.mozilla.org/show_bug.cgi?id=1763626

and we have "strict_min_version": "112.0", so we're good here 👌

Thank you @Standard8 👏

@leplatrem leplatrem merged commit e8ca889 into mozilla-extensions:master Apr 19, 2024
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