Cryolite/nonalt-reblog

Refactor the structure of the local storage

Cryolite opened this issue · 0 comments

From the very beginning stage of development, this Chrome extension records the URL of reblogged images directly under the local storage. However, as more functions have been added to this extension, additional data other than the URLs of reblogged images are stored in the local storage. As a result, the structure of the local storage has become somewhat complicated, and this is particularly evident in the complexity of the type of data structure in the local storage (cf.

export interface LocalStorageData {
// TODO: Consider storing image URLs in a subitem.
[imageUrl: string]: Date | ReblogQueue[] | Record<string, Image[]> | undefined;
reblogQueue?: ReblogQueue[];
postUrlToImages?: Record<string, Image[]>;
}
).

This issue proposes to refactor the data structure of the local storage based on the following migration plan.

  1. Create the reblogHistory property in the local storage, and move the URLs of reblogged images recorded directly under the local storage under the reblogHistory property. After that, the URLs of newly reblogged images are also recorded under the reblogHistory property.
  2. After an appropriate migration period, change the local storage type and complete the migration.