question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@iconify/react addCollections being called, but still loading from API?

See original GitHub issue

After the move to webpack v5, I’m seeing my @iconify/react <InlineIcon> components are attempting to load my ‘custom’ fonts from the Iconify API provider, despite having called addCollection() at the initialization of my app.

JSON collection:

{ prefix: "custom", icons: { "leaf": {"body": "<path d=\"  ...  } } }

App initialization, this is called prior to the first render of any component:

import customFont from './path-to-file/custom.json';
import { addCollection } from '@iconify/react';

function initialize()
{
    addCollection(customFont)
}

Usage:

import { InlineIcon } from '@iconify/react';

...

render()
{
    return ( <InlineIcon icon="custom:leaf" /> );
}

Is anyone else experiencing a similar issue? The rest of our application bundling appears to work as expected.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
cyberaliencommented, Jan 10, 2022

Thank you for the quick responses! Would you mind tagging this issue once it’s published to latest?

It has been published to latest.

1reaction
cyberaliencommented, Jan 4, 2022

Awesome. I’ll keep this for now as a temporary solution, will create proper tests to test it all (should be a challenge in itself because it can only be tested in real browser), then will publish this as latest version of all components.

In future I think this function will be removed. Instead I’ll attempt to share all data between instances, including functions. But that’s an idea for next major version of components, not minor version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Iconify for React Function: loadIcons
This tutorial is part of Iconify for React with API functions tutorial. Function loadIcons() retrieves icons from Iconify API. When to use this...
Read more >
@iconify/react - npm
Loads icons on demand. No need to bundle icons, component will automatically load icon data for icons that you use from Iconify API....
Read more >
[Feature Request] Iconify Support · Issue #7821 · vuetifyjs/vuetify
Another solution is to bundle icons with package instead of loading icons from API. I've built React component that works like that: https:// ......
Read more >
Building a Dynamic React Ecommerce Application - ButterCMS
React Ecommerce: Learn how to build a dynamic e-commerce ... because it is an API and just needs to be called and your...
Read more >
Integrating Google Maps with React - LogRocket Blog
Google Maps is flexible and powerful enough to handle a wide variety of use cases, and it can provide real value to users...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found