Skip to content

Add length check to stop dashboard from crashing

wattry requested to merge wattry/dashboard:wattry into main

Likely linked to this issue

Error caught when dashboard crashed. Noticed that if data is not yet fetched checking the .length prop would result in this error.

ErrorBoundary.js:15 ERROR TypeError: Cannot read properties of null (reading 'length')
    at Wv (VulnerabilityReportCard.js:12:57)
    at oo (react-dom.production.min.js:157:137)
    at Ys (react-dom.production.min.js:267:460)
    at Mu (react-dom.production.min.js:250:347)
    at Tu (react-dom.production.min.js:250:278)
    at Au (react-dom.production.min.js:250:138)
    at bu (react-dom.production.min.js:243:163)
    at react-dom.production.min.js:123:115
    at t.unstable_runWithPriority (scheduler.production.min.js:18:343)
    at Wi (react-dom.production.min.js:122:325)
useK8sDataWebSocket.js:91 WebSocket closed

reports?.length will be undefined if reports is null or undefined

Edited by wattry

Merge request reports