SenseNet / sn-client

Monorepo for sensenet client packages 🐱‍💻
https://sensenet.com
GNU General Public License v2.0
25 stars 37 forks source link

Handle unexpected null values on Dashboard #1353

Closed enikonemeth closed 2 years ago

enikonemeth commented 3 years ago

There was an error on snover-staging:

An error occured and your request couldn't be completed. TypeError: Cannot read property 'user' of null at SubscriptionWidget (https://admin.test.sensenet.com/static/js/dashboard.96fc971f.chunk.js:1:4133) at oh (https://admin.test.sensenet.com/static/js/227.bd5699e0.js:2:1657178) at ml (https://admin.test.sensenet.com/static/js/227.bd5699e0.js:2:1707063) at Qj (https://admin.test.sensenet.com/static/js/227.bd5699e0.js:2:1699257) at Kj (https://admin.test.sensenet.com/static/js/227.bd5699e0.js:2:1699180) at yj (https://admin.test.sensenet.com/static/js/227.bd5699e0.js:2:1695991) at https://admin.test.sensenet.com/static/js/227.bd5699e0.js:2:1643238 at Re.unstable_runWithPriority (https://admin.test.sensenet.com/static/js/227.bd5699e0.js:2:1933168) at cg (https://admin.test.sensenet.com/static/js/227.bd5699e0.js:2:1642923) at fg (https://admin.test.sensenet.com/static/js/227.bd5699e0.js:2:1643176) Error message: Cannot read property 'user' of null

the backend respone was:

  "name": null,
  "displayName": null,
  "host": null,
  "pending": null,
  "version": {
    "title": null,
    "date": "0001-01-01T00:00:00",
    "latest": true
  },
  "subscription": {
    "plan": {
      "name": null,
      "displayName": null,
      "baseprice": 0.0,
      "limitations": null
    },
    "expirationDate": "0001-01-01T00:00:00"
  },
  "usage": {
    "content": 149,
    "user": 15,
    "group": 4,
    "workspace": 2,
    "contentType": 7,
    "storage": {
      "available": 0,
      "files": 15741830,
      "content": 2476254,
      "oldVersions": 0,
      "log": 25162787,
      "system": 32370754
    }
  }
}

~We should try to handle the null values on Dashboard~

Try to check at the beginning that the current repository's type is Other. If it is true, the dashboard boxes should not be rendered, if the repo has any other type, the subscription value's will not be null and the boxes could be rendered.

tusmester commented 3 years ago

Check if this is related to https://github.com/SenseNet/sensenet/issues/1544