gimlet-io / capacitor

A general purpose UI for FluxCD.
Apache License 2.0
476 stars 13 forks source link

Bug: UI crashes at start with "undefined (reading 'slice')" #108

Open romainourgorry opened 2 weeks ago

romainourgorry commented 2 weeks ago

Hello,

I'm running Capacitor version 0.4.2. I tested it from both Brave and Safari browsers, and I have the same behaviour.

When I open the UI it becomes blanks after few seconds and I see this error when I inspect the page:

TypeError: Cannot read properties of undefined (reading 'slice')
    at jr (Kustomization.jsx:107:31)
    at ko (react-dom.production.min.js:167:137)
    at ks (react-dom.production.min.js:290:337)
    at xu (react-dom.production.min.js:280:389)
    at gu (react-dom.production.min.js:280:320)
    at yu (react-dom.production.min.js:280:180)
    at ou (react-dom.production.min.js:271:88)
    at iu (react-dom.production.min.js:268:429)
    at S (scheduler.production.min.js:13:203)
    at MessagePort._ (scheduler.production.min.js:14:128)
dl @ react-dom.production.min.js:189
Show 1 more frame
Show less
react-dom.production.min.js:283 Uncaught TypeError: Cannot read properties of undefined (reading 'slice')
    at jr (Kustomization.jsx:107:31)
    at ko (react-dom.production.min.js:167:137)
    at ks (react-dom.production.min.js:290:337)
    at xu (react-dom.production.min.js:280:389)
    at gu (react-dom.production.min.js:280:320)
    at yu (react-dom.production.min.js:280:180)
    at ou (react-dom.production.min.js:271:88)
    at iu (react-dom.production.min.js:268:429)
    at S (scheduler.production.min.js:13:203)
    at MessagePort._ (scheduler.production.min.js:14:128)

It seems the issue comes from the line 107 in Kustomization.jsx file:

const url = source.spec.url.slice(source.spec.url.indexOf('@') + 1)

Thank you

romainourgorry commented 2 weeks ago

I tested it with the version 0.4.0 and I have the same issue