File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -489,7 +489,7 @@ class Grid extends React.Component<
489489
490490 // Load blacklist and snippets
491491 this . BLACKLIST = await getBlacklist ( ) ;
492- this . SNIPPETS = await fetchCssSnippets ( ) ;
492+ this . SNIPPETS = await fetchCssSnippets ( this . CONFIG . visual . hideInstalled ) ;
493493 this . newRequest ( ITEMS_PER_REQUEST ) ;
494494 }
495495
Original file line number Diff line number Diff line change @@ -303,7 +303,7 @@ export const getBlacklist = async () => {
303303 * It fetches the snippets.json file from the Github repository and returns it as an array of snippets.
304304 * @returns Array of snippets
305305 */
306- export const fetchCssSnippets = async ( ) => {
306+ export const fetchCssSnippets = async ( hideInstalled = false ) => {
307307 const snippetsJSON = ( await fetch ( SNIPPETS_URL )
308308 . then ( ( res ) => res . json ( ) )
309309 . catch ( ( ) => [ ] ) ) as Snippet [ ] ;
@@ -318,8 +318,13 @@ export const fetchCssSnippets = async () => {
318318 snip . preview = undefined ;
319319 }
320320
321- accum . push ( snip ) ;
321+ // Hide installed snippets if option is set and it's installed
322+ if ( ! ( hideInstalled && localStorage . getItem ( `marketplace:installed:snippet:${ snip . title . replaceAll ( " " , "-" ) } ` ) ) ) {
323+ accum . push ( snip ) ;
324+ }
325+
322326 return accum ;
323327 } , [ ] ) ;
328+
324329 return snippets ;
325330} ;
You can’t perform that action at this time.
0 commit comments