Skip to content
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
2 changes: 1 addition & 1 deletion src/components/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ class Grid extends React.Component<

// Load blacklist and snippets
this.BLACKLIST = await getBlacklist();
this.SNIPPETS = await fetchCssSnippets();
this.SNIPPETS = await fetchCssSnippets(this.CONFIG.visual.hideInstalled);
this.newRequest(ITEMS_PER_REQUEST);
}

Expand Down
9 changes: 7 additions & 2 deletions src/logic/FetchRemotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export const getBlacklist = async () => {
* It fetches the snippets.json file from the Github repository and returns it as an array of snippets.
* @returns Array of snippets
*/
export const fetchCssSnippets = async () => {
export const fetchCssSnippets = async (hideInstalled = false) => {
const snippetsJSON = (await fetch(SNIPPETS_URL)
.then((res) => res.json())
.catch(() => [])) as Snippet[];
Expand All @@ -318,8 +318,13 @@ export const fetchCssSnippets = async () => {
snip.preview = undefined;
}

accum.push(snip);
// Hide installed snippets if option is set and it's installed
if (!(hideInstalled && localStorage.getItem(`marketplace:installed:snippet:${snip.title.replaceAll(" ", "-")}`))) {
accum.push(snip);
}

return accum;
}, []);

return snippets;
};