Skip to content

Commit 606c432

Browse files
authored
Merge pull request #85 from Flow-Launcher/plugin-store-fix-undefined
Fix an error when searching the plugin list if a description or an author field doesn't exist
2 parents 80f4c80 + d2746dd commit 606c432

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

webcomponents/src/components/PluginDisplay.svelte

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export let plugin: FlowPlugin;
1313
</a>
1414
</div>
1515
</td>
16-
<td>{plugin.Description}</td>
17-
<td>{plugin.Author}</td>
18-
<td>{plugin.Version}</td>
16+
<td>{plugin.Description ?? ""}</td>
17+
<td>{plugin.Author ?? ""}</td>
18+
<td>{plugin.Version ?? ""}</td>
1919
</tr>
2020

2121
<style>

webcomponents/src/webcomponents/PluginDirectory.svelte

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ $: {
5757
if (trimmedSearch.length === 0) {
5858
return true;
5959
}
60-
return v.Name.toLowerCase().includes(trimmedSearch) || v.Description.toLowerCase().includes(trimmedSearch) || v.Author.toLowerCase().includes(trimmedSearch);
60+
return v.Name.toLowerCase().includes(trimmedSearch) || v.Description?.toLowerCase().includes(trimmedSearch) || v.Author?.toLowerCase().includes(trimmedSearch);
6161
})
6262
.sort((a, b) => {
6363
switch (sorting) {
@@ -66,9 +66,9 @@ $: {
6666
case 'nameDesc':
6767
return b.Name.localeCompare(a.Name);
6868
case 'authorAsc':
69-
return a.Author.localeCompare(b.Author);
69+
return a.Author?.localeCompare(b?.Author) ?? -1;
7070
case 'authorDesc':
71-
return b.Author.localeCompare(a.Author);
71+
return b.Author?.localeCompare(a?.Author) ?? 1;
7272
case 'dateAsc':
7373
return a.DateAdded.localeCompare(b.DateAdded);
7474
case 'dateDesc':

0 commit comments

Comments
 (0)