Skip to content

Commit

Permalink
Merge pull request #85 from Flow-Launcher/plugin-store-fix-undefined
Browse files Browse the repository at this point in the history
Fix an error when searching the plugin list if a description or an author field doesn't exist
  • Loading branch information
Yusyuriv authored Jul 10, 2024
2 parents 80f4c80 + d2746dd commit 606c432
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions webcomponents/src/components/PluginDisplay.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export let plugin: FlowPlugin;
</a>
</div>
</td>
<td>{plugin.Description}</td>
<td>{plugin.Author}</td>
<td>{plugin.Version}</td>
<td>{plugin.Description ?? ""}</td>
<td>{plugin.Author ?? ""}</td>
<td>{plugin.Version ?? ""}</td>
</tr>

<style>
Expand Down
6 changes: 3 additions & 3 deletions webcomponents/src/webcomponents/PluginDirectory.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ $: {
if (trimmedSearch.length === 0) {
return true;
}
return v.Name.toLowerCase().includes(trimmedSearch) || v.Description.toLowerCase().includes(trimmedSearch) || v.Author.toLowerCase().includes(trimmedSearch);
return v.Name.toLowerCase().includes(trimmedSearch) || v.Description?.toLowerCase().includes(trimmedSearch) || v.Author?.toLowerCase().includes(trimmedSearch);
})
.sort((a, b) => {
switch (sorting) {
Expand All @@ -66,9 +66,9 @@ $: {
case 'nameDesc':
return b.Name.localeCompare(a.Name);
case 'authorAsc':
return a.Author.localeCompare(b.Author);
return a.Author?.localeCompare(b?.Author) ?? -1;
case 'authorDesc':
return b.Author.localeCompare(a.Author);
return b.Author?.localeCompare(a?.Author) ?? 1;
case 'dateAsc':
return a.DateAdded.localeCompare(b.DateAdded);
case 'dateDesc':
Expand Down

0 comments on commit 606c432

Please sign in to comment.