Skip to content

Commit 9c06820

Browse files
[6.x] Fix duplicate items in the Command Palette's "Recent" category (#13471)
Co-authored-by: Jason Varga <jason@pixelfear.com>
1 parent 9e3bede commit 9c06820

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

resources/js/components/command-palette/CommandPalette.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ function getRecentItems() {
224224
}
225225
226226
function addToRecentItems(item) {
227-
item.category = __('Recent');
227+
const recentItem = { ...item, category: __('Recent') };
228228
229229
const filtered = getRecentItems().filter(recentItem => recentItem.text !== item.text);
230-
const updated = [item, ...filtered].slice(0, 5);
230+
const updated = [recentItem, ...filtered].slice(0, 5);
231231
232232
localStorage.setItem('statamic.command-palette.recent', JSON.stringify(updated));
233233

0 commit comments

Comments
 (0)