Skip to content

Add Button to expand recents. Simplify localStorage.#592

Merged
subdavis merged 4 commits into
mainfrom
desktop/recents-updates
Mar 1, 2021
Merged

Add Button to expand recents. Simplify localStorage.#592
subdavis merged 4 commits into
mainfrom
desktop/recents-updates

Conversation

@subdavis
Copy link
Copy Markdown
Contributor

@subdavis subdavis commented Feb 23, 2021

At one point earlier today I managed to write 400 lines of code including a full schema migration to support a new field called lastUpdated. I discarded all those changes and re-wrote it to be as simple as possible.

  • Still sorts by creation time, which may not be ideal.
  • Simple more/less toggle. If we get more than like 100, we'll need more options, but this is fine for now.
  • Added some code to remove most of the of unnecessary cost in storage and serialization from large image sequences.
  • Backed out that dumb thing where I show either 1 or a stack of images. Now all image sequences are just a stack.\

fixes #591

@subdavis subdavis force-pushed the desktop/recents-updates branch from 291f557 to d7057d0 Compare February 23, 2021 02:10
@subdavis subdavis requested a review from BryonLewis March 1, 2021 16:03
@subdavis
Copy link
Copy Markdown
Contributor Author

subdavis commented Mar 1, 2021

Forgot to request.

BryonLewis
BryonLewis previously approved these changes Mar 1, 2021
Copy link
Copy Markdown
Collaborator

@BryonLewis BryonLewis left a comment

Choose a reason for hiding this comment

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

Works perfectly fine. I have that one comment but I don't feel strongly about it. The end result is clear because of the comments and I imagine any future issue would begin with following the data path and noting that the Image lists get removed.

Comment on lines +50 to +58
/**
* Erase image lists from meta object stored in recents.
* Saves space and serialization cost since these parts of
* the recents object aren't used in this way.
*/
imageData: [],
originalImageFiles: [],
transcodedImageFiles: [],
});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I know it's a pain but I'm wondering if we should really be using a different type here given this comment and the one above about the localCachedMeta being different from JsonMeta?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid. I originally did this. There's a couple of ways to hack "subtraction" to extends an interface by removing fields in typescript. I ended up not liking the results and just went with the comment.

This actually goes against my philosophy about never telling lies to the type system, but it just felt so weird to redeclare a core interface here.

What approach would you prefer?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I looked into the subtraction stuff quickly when I was doing my review and I had the same reaction.

I say a new type that has the overlapping data expected for the frontend cached dataset to work. It clearly separates them as localCacheMeta is derived from JsonMeta and not the same thing.

It also gives a place to store future optional data that is relevant to the front-end display but not required to be stored in JsonMeta. Like we may want to edit the load of recents process to indicate to the user that the source file/folder is missing (I don't know if we want to test for sourcedata for each item in recents on each app load, just an example). That could be added as an optional localCacheMeta property easily showing the user that some of their recents have been moved or deleted outside of DIVE.

Copy link
Copy Markdown
Collaborator

@BryonLewis BryonLewis left a comment

Choose a reason for hiding this comment

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

looks good

@subdavis subdavis merged commit f82aa93 into main Mar 1, 2021
@subdavis subdavis deleted the desktop/recents-updates branch March 5, 2021 18:23
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.

[BUG] Recents get truncated at 20

2 participants