mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
046b06fe72
ref https://ghost-foundation.sentry.io/issues/5908152800/ - In the current state, we are maintaining an 'index' key for all revisions in localStorage. This gives us quick and easy access to all the revisions in localStorage, but it requires additional "bookkeeping" to update the index each time we add/remove a key. - In some obscure edge cases, this results in the `remove()` method throwing a `QuotaExceededError` (since removing a revision also requires updating the index with `localStorage.setItem()`). If the `remove()` call fails, we are sort of stuck — the only way to reduce our storage usage is to remove items, but if the `remove()` method throws errors, we can't do that. - This change removes the whole index concept, and instead loops over all the keys in localStorage, filtering by the prefix to find all our revisions. This makes the `keys()` method slightly more complex, as it has to filter out keys in localStorage that aren't related to revisions, but it simplifies saving and removing revisions. - Critically, this also means that `remove()` should never throw a `QuotaExceededError`, since it no longer needs to call `localStorage.setItem()` — it now simply calls `localStorage.removeItem()` for the revision, which should never fail. |
||
---|---|---|
.. | ||
ajax.js | ||
billing.js | ||
clock.js | ||
config-manager.js | ||
custom-theme-settings.js | ||
custom-views.js | ||
dashboard-mocks.js | ||
dashboard-stats.js | ||
data-cache.js | ||
dropdown.js | ||
event-bus.js | ||
explore.js | ||
feature.js | ||
frontend.js | ||
ghost-paths.js | ||
koenig.js | ||
lazy-loader.js | ||
limit.js | ||
local-revisions.js | ||
media-queries.js | ||
member-import-validator.js | ||
members-count-cache.js | ||
members-stats.js | ||
members-utils.js | ||
mention-utils.js | ||
migrate.js | ||
modals.js | ||
navigation.js | ||
notifications.js | ||
onboarding.js | ||
resize-detector.js | ||
search-provider-basic.js | ||
search-provider-flex.js | ||
search.js | ||
session.js | ||
settings.js | ||
slug-generator.js | ||
tenor.js | ||
theme-management.js | ||
ui.js | ||
unsplash.js | ||
upgrade-status.js | ||
utils.js | ||
whats-new.js |