// Due to the grafana/ui Icon component making fetch requests to // `/public/img/icon/.svg` we need to mock react-inlinesvg to prevent // the failed fetch requests from displaying errors in console. import React from 'react'; type Callback = (...args: any[]) => void; export interface StorageItem { content: string; queue: Callback[]; status: string; } export const cacheStore: { [key: string]: StorageItem } = Object.create(null); const SVG_FILE_NAME_REGEX = /(.+)\/(.+)\.svg$/; const InlineSVG = ({ src }: { src: string }) => { // testId will be the file name without extension (e.g. `public/img/icons/angle-double-down.svg` -> `angle-double-down`) const testId = src.replace(SVG_FILE_NAME_REGEX, '$2'); return ; }; export default InlineSVG;