Seeing an issue on this line of code in SVG handling

Hi Plasmic team, we’re seeing an issue on this line of code. Where if the file that is read in is an svg everything works accordingly. But if its not an svg we see an error message that I posted in this thread when running jest tests.

 TypeError: Cannot read properties of undefined (reading 'endsWith')

      70 |   });
      71 |   test('renders correctly for fs product family', () => {
    > 72 |     const { container } = render(
         |                           ^
      73 |       <ExperienceState.Provider
      74 |         value={{
      75 |           name: 'superAwesomeExperience',

      at isSvg (node_modules/@plasmicapp/react-web/src/render/PlasmicImg/index.tsx:383:14)
      at PlasmicImg (node_modules/@plasmicapp/react-web/src/render/PlasmicImg/index.tsx:169:5)
      at renderWithHooks (node_modules/react-dom/cjs/react-dom.development.js:14985:18)
      at updateForwardRef (node_modules/react-dom/cjs/react-dom.development.js:17044:20)
      at beginWork (node_modules/react-dom/cjs/react-dom.development.js:19098:16)
      at HTMLUnknownElement.callCallback (node_modules/react-dom/cjs/react-dom.development.js:3945:14)
      at HTMLUnknownElement.callTheUserObjectsOperation (node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30)
      at innerInvokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:338:25)
      at invokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:274:3)
      at HTMLUnknownElementImpl._dispatch (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:221:9)
      at HTMLUnknownElementImpl.dispatchEvent (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:94:17)
      at HTMLUnknownElement.dispatchEvent (node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:231:34)
      at Object.invokeGuardedCallbackDev (node_modules/react-dom/cjs/react-dom.development.js:3994:16)
      at invokeGuardedCallback (node_modules/react-dom/cjs/react-dom.development.js:4056:31)
      at beginWork$1 (node_modules/react-dom/cjs/react-dom.development.js:23964:7)
      at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:22779:12)
      at workLoopSync (node_modules/react-dom/cjs/react-dom.development.js:22707:5)
      at renderRootSync (node_modules/react-dom/cjs/react-dom.development.js:22670:7)
      at performSyncWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:22293:18)
      at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom.development.js:21881:7)
      at updateContainer (node_modules/react-dom/cjs/react-dom.development.js:25482:3)
      at node_modules/react-dom/cjs/react-dom.development.js:26021:7
      at unbatchedUpdates (node_modules/react-dom/cjs/react-dom.development.js:22431:12)
      at legacyRenderSubtreeIntoContainer (node_modules/react-dom/cjs/react-dom.development.js:26020:5)
      at Object.render (node_modules/react-dom/cjs/react-dom.development.js:26103:10)
      at node_modules/@testing-library/react/dist/pure.js:101:25
      at batchedUpdates$1 (node_modules/react-dom/cjs/react-dom.development.js:22380:12)
      at act (node_modules/react-dom/cjs/react-dom-test-utils.development.js:1042:14)
      at render (node_modules/@testing-library/react/dist/pure.js:97:26)
      at Object.<anonymous> (components/plasmic/ScreenProductRecommendation.spec.js:72:27)

I’ve taken a look at it a bit deeper and it might be an issue with isSvg. Can you test this line of code to run other than svg, and load a png?

hmm are you able to debug and see what is being passed into isSvg? It’s supposed to be the image url string, but it looks like something that’s not a string is being passed in

We found a fix for it. What worked for us is to change the image we used to a svg and upload it as an Icon instead of an Image

Yes we debugged it. When it was an svg the svg object was passed. The image that was imported was null.

Might be an issue in how our test configuration is set up. But not sure