Skip to content

Commit 1024fa0

Browse files
authored
Merge pull request #208 from webduinoio/bug/8110
Bug/8110
2 parents f08af1b + 3b553e8 commit 1024fa0

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
## [1.12.2] - 2024.8.27
10+
11+
### Fixed
12+
13+
- 查詢後,無法再次查詢 [#8110](https://redmine.kingkit.codes/issues/8110)
14+
15+
## [1.12.1] - 2024.8.23
16+
917
### Fixed
1018

1119
- 小助教查詢問題 [#8106](https://redmine.kingkit.codes/issues/8106)
@@ -237,7 +245,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
237245
- 問題回復處理 [#7029](https://redmine.kingkit.codes/issues/7029)
238246
- 小書僮清單卡片樣式跑掉 [#6983](https://redmine.kingkit.codes/issues/6983)
239247

240-
[Unreleased]: https://github.com/webduinoio/pluto-frontend/compare/v1.12.0...HEAD
248+
[Unreleased]: https://github.com/webduinoio/pluto-frontend/compare/v1.12.2...HEAD
249+
[1.12.2]: https://github.com/webduinoio/pluto-frontend/compare/v1.12.1...v1.12.2
250+
[1.12.1]: https://github.com/webduinoio/pluto-frontend/compare/v1.12.0...v1.12.1
241251
[1.12.0]: https://github.com/webduinoio/pluto-frontend/compare/v1.11.2...v1.12.0
242252
[1.11.2]: https://github.com/webduinoio/pluto-frontend/compare/v1.10.1...v1.11.2
243253
[1.11.1]: https://github.com/webduinoio/pluto-frontend/compare/v1.10.1...v1.11.1

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-project",
3-
"version": "1.12.0",
3+
"version": "1.12.2",
44
"private": true,
55
"scripts": {
66
"dev": "vite --host --https --port 443",

src/views/HomeView.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,17 @@ const loadActors = async () => {
148148
lastIndex: get(dataLastIndex),
149149
search: searchQuery.value,
150150
});
151+
// !這裡加上判斷式,是由於 onSearch 及 onLoad 會同時呼叫 loadActors
152+
// 由於 onSearch 清除 data,當 data 變動時,onLoad 也會被觸發
151153
if (value.list) {
152-
data.value.push(...value.list);
154+
// 使用 Set 來跟蹤已存在的 id
155+
const existingIds = new Set(data.value.map((item: Actor) => item.id));
156+
157+
// 過濾掉重複的項目
158+
const filteredList = value.list.filter((item: Actor) => !existingIds.has(item.id));
159+
160+
// 將過濾後的項目添加到 data 中
161+
data.value.push(...filteredList);
153162
set(dataLastIndex, value.lastIndex);
154163
}
155164
return value;
@@ -174,8 +183,9 @@ const onLoad = async ({ done }: { done: Function }) => {
174183
};
175184
176185
const onSearch = async () => {
177-
set(data, []);
186+
data.value.splice(0, data.value.length);
178187
set(dataLastIndex, '');
188+
await loadActors();
179189
};
180190
</script>
181191

@@ -284,4 +294,4 @@ const onSearch = async () => {
284294
font-family: 'Poppins', sans-serif;
285295
}
286296
}
287-
</style>
297+
</style>

0 commit comments

Comments
 (0)