-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/update grouped images #100
Conversation
…-images merging with latest branch
…l. and added a watcher in thumbnailrow component
…image with the same smartstack value comes. Images are updating as they come too. And images are being stored in an array because Vue is more reactive to arrays than objects (which is why images were not updating as they were received)
…space. leaving the commented out code there for when Wayne wants to use the group_images feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing pr description - thank you
Approved for trial deployment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of great work that went into this! Just one suggestion to add a comment explaining what the getter is doing, but ready to merge after that!
@@ -59,7 +59,29 @@ const getters = { | |||
current_image: state => state.current_image, | |||
recent_images: state => state.recent_images, | |||
user_images: state => state.user_images, | |||
grouped_images: state => state.grouped_images, | |||
// grouped_images: state => state.grouped_images, | |||
recent_images_condensed: state => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be helpful to include a comment describing an overview of what this getter is doing, something along the lines of 'Same as recent_images
but removes any intermediate smartstack frames, so you only see the latest version of each smart stack'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Added comment!
FEATURE UPDATE: Update Image Grouping and Display
DESCRIPTION
Background:
After having grouped images, more details here, @wrosing noticed that a couple of issues emerged. First, thumbnails were taking a really long time to load. And second, the ThumbnailRow component was not updating with new images as they were coming. Only after the user would refresh the page, would the new images show up. Additionally, sometimes the images would show up at the very end of the ThumbnailRow rather than at the beginning.
Implementation:
With the extensive help and advice of @timbeccue, I learned that Vue is not as reactive to
group_images
because of its data structures. Instead, it's best to store images in an array so that the UI can re-render when the state has updated (i.e. when new images come). This new implementation can be found on lines 63-72 ofimages.js
.This new implementation, written by @timbeccue, goes as follows:
recent_images
and with thereduce
method, it creates a map (maxSSTKNUMs
) where the key isSMARTSTK
and the value is the greatestSSTKNUM
found in therecent_images
arrayheader
, aSMARTSTK
, or aSSTKNUM
(stack number). If it doesn't have any, then we return the acc as is.SMARTSTK
in the array of image objects, it finds the max value ofSSTKNUM
. If the current image has aSMARTSTK
value that is not yet in the acc object OR if theSSTKNUM
value (parsed to an integer) is greater than the currently one stored in acc for that existingSMARTSTK
, it updates the acc with the new maximumSSTKNUM
for thatSMARTSTK
.recent_images
array to include items that either don't have aheader
,SMARTSTK
, orSSTKNUM
OR have the maximumSSTKNUM
for theSMARTSTK
associated with it.filteredArr
Updated Features:
Visuals:
Before taking an image
After taking an image and without having to refresh the site