Skip to content

Commit

Permalink
fix bug where thumbnails within a scene not updating
Browse files Browse the repository at this point in the history
always invalidate thumbnail cache key when saveImageFile updates the thumbnail

- fix bug where thumbnails in a scene would not update properly when board was drawn on
- fix bug where non-current thumbnail would not be changed when linked board changes
  • Loading branch information
audionerd committed Oct 6, 2017
1 parent abcc8db commit 6aa5d88
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/js/window/main-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,9 @@ let saveImageFile = async () => {
// create/update the thumbnail image file if necessary
let indexToSave = currentBoard // copy value
if (shouldSaveThumbnail) {
// explicitly indicate to renderer that the file has changed
setEtag(path.join(boardPath, 'images', boardModel.boardFilenameForThumbnail(board)))

await saveThumbnailFile(indexToSave)
await updateThumbnailDisplayFromFile(indexToSave)
}
Expand Down Expand Up @@ -1673,10 +1676,6 @@ const onLinkedFileChange = async (eventType, filepath, stats) => {
return
}

// electron will cache the image, not realizing it has changed by external process
// so we explicitly indicate to renderer that the file has changed
setEtag(path.join(boardPath, 'images', boardModel.boardFilenameForThumbnail(board)))

if (isCurrentBoard) {
storeUndoStateForImage(false, [0, 1, 3])
markImageFileDirty([0, 1, 3]) // reference, main, notes layers
Expand All @@ -1688,6 +1687,9 @@ const onLinkedFileChange = async (eventType, filepath, stats) => {
psdData.notes && saveDataURLtoFile(psdData.notes, board.url.replace('.png', '-notes.png'))
psdData.reference && saveDataURLtoFile(psdData.reference, board.url.replace('.png', '-reference.png'))

// explicitly indicate to renderer that the file has changed
setEtag(path.join(boardPath, 'images', boardModel.boardFilenameForThumbnail(board)))

let index = await saveThumbnailFile(boardData.boards.indexOf(board))
await updateThumbnailDisplayFromFile(index)
}
Expand Down

0 comments on commit 6aa5d88

Please sign in to comment.