Skip to content
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

[stable30] fix: invalid keys #2710

Merged
merged 3 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions .github/workflows/node-when-unrelated.yml

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/viewer-init.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* extracted by css-entry-points-plugin */
@import './init-BT5Phsd1.chunk.css';
@import './init-CGjTNE8M.chunk.css';
@import './previewUtils-BffjDTy3.chunk.css';
@import './NcActionButton-WAAyMq9-.chunk.css';
@import './NcActionLink-C3uWgqfV.chunk.css';
2 changes: 1 addition & 1 deletion css/viewer-main.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* extracted by css-entry-points-plugin */
@import './main-D_aIfD80.chunk.css';
@import './main-DKwmbWFy.chunk.css';
@import './previewUtils-BffjDTy3.chunk.css';
2 changes: 2 additions & 0 deletions js/index-BKIG0lGC.chunk.mjs

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions js/index-Bqey0e5S.chunk.mjs

This file was deleted.

4 changes: 2 additions & 2 deletions js/viewer-init.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-init.mjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.mjs.map

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/components/Images.vue
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ img, video {
linear-gradient(45deg, transparent 75%, #{$checkered-color} 75%),
linear-gradient(45deg, transparent 75%, #{$checkered-color} 75%),
linear-gradient(45deg, #{$checkered-color} 25%, #fff 25%);
background-size: 2 * $checkered-size 2 * $checkered-size;
background-size: #{2 * $checkered-size} #{2 * $checkered-size};
background-position: 0 0, 0 0, -#{$checkered-size} -#{$checkered-size}, $checkered-size $checkered-size;
}
&.loaded {
Expand Down
36 changes: 21 additions & 15 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
:data-handler="handlerId">
<component :is="currentFile.modal"
v-if="!currentFile.failed"
:key="currentFile | uniqueKey"
:key="uniqueKey(currentFile)"
ref="content"
:active="true"
:can-swipe="false"
Expand Down Expand Up @@ -117,7 +117,7 @@
<!-- COMPARE FILE -->
<div v-if="comparisonFile && !comparisonFile.failed && showComparison" class="viewer__file-wrapper">
<component :is="comparisonFile.modal"
:key="comparisonFile | uniqueKey"
:key="uniqueKey(comparisonFile)"
ref="comparison-content"
v-bind="comparisonFile"
:active="true"
Expand All @@ -132,8 +132,8 @@
</div>

<!-- PREVIOUS -->
<div v-if="previousFile"
:key="previousFile | uniqueKey"
<div v-if="hasPreviousFile"
:key="uniqueKey(previousFile)"
class="viewer__file-wrapper viewer__file-wrapper--hidden"
aria-hidden="true"
inert>
Expand All @@ -149,7 +149,7 @@
</div>

<!-- CURRENT -->
<div :key="currentFile | uniqueKey" class="viewer__file-wrapper">
<div :key="uniqueKey(currentFile)" class="viewer__file-wrapper">
<component :is="currentFile.modal"
v-if="!currentFile.failed"
ref="content"
Expand All @@ -169,8 +169,8 @@
</div>

<!-- NEXT -->
<div v-if="nextFile"
:key="nextFile | uniqueKey"
<div v-if="hasNextFile"
:key="uniqueKey(nextFile)"
class="viewer__file-wrapper viewer__file-wrapper--hidden"
aria-hidden="true"
inert>
Expand Down Expand Up @@ -242,12 +242,6 @@ export default defineComponent({
Pencil,
},

filters: {
uniqueKey(file) {
return '' + file.fileid + file.source
},
},

mixins: [isFullscreen, isMobile],

data() {
Expand Down Expand Up @@ -341,6 +335,15 @@ export default defineComponent({
return this.currentIndex === this.fileList.length - 1
},

hasPreviousFile() {
// Check if empty object
return Object.keys(this.previousFile).length > 0
},
hasNextFile() {
// Check if empty object
return Object.keys(this.nextFile).length > 0
},

isImage() {
return ['image/jpeg', 'image/png', 'image/webp'].includes(this.currentFile?.mime)
},
Expand Down Expand Up @@ -580,6 +583,9 @@ export default defineComponent({
},

methods: {
uniqueKey(file) {
return '' + file.fileid + file.source
},
async beforeOpen() {
// initial loading start
this.initiated = true
Expand Down Expand Up @@ -780,7 +786,7 @@ export default defineComponent({
}
} else {
// RESET
this.previousFile = null
this.previousFile = {}
}

if (next) {
Expand All @@ -790,7 +796,7 @@ export default defineComponent({
}
} else {
// RESET
this.nextFile = null
this.nextFile = {}
}

},
Expand Down
Loading