Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storeSvg isn't working with GraphQL when using custom provider #70

Open
avodynamics opened this issue Nov 10, 2024 · 1 comment
Open

Comments

@avodynamics
Copy link

Here's an example usage.
The GraphQL endpoint shows null for svg

import {defineField} from 'sanity'
import React from 'react'
import * as LucideIcons from 'lucide-react'

export const iconField = defineField({
  title: 'Icon',
  name: 'icon',
  type: 'iconPicker',
  options: {
    storeSvg: true,
    configurations: [
      {
        title: 'Lucide',
        provider: 'lucide',
        icons: (options) =>
          Object.entries(LucideIcons).map(([name, Component]) => ({
            name,
            component: () => <Component width="1.5em" height="1em" />,
            tags: [name],
          })),
      },
    ],
  },
})
@avodynamics
Copy link
Author

Actually, it does work. The problem was that I had put icons into the documents and then changed the options without removing and re-adding the images again via the migration script.

I think this should be more clear in the sections descripting the storeSvg and the outputFormat options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant