sagemathinc / cocalc

CoCalc: Collaborative Calculation in the Cloud
https://CoCalc.com
Other
1.14k stars 207 forks source link

flyouts/files: crash in filesStore.toJS #7550

Closed haraldschilly closed 2 months ago

haraldschilly commented 2 months ago

I saw this error

TypeError: e.toJS is not a function
    at https://cocalc.com/static/app-a8f436d26aa45c7b90d2.js?f72bb682e99e8565f71e:2:5750944
    at Object.Xo [as useMemo] (https://cocalc.com/static/load-f686fcd7daedf046f9eb.js?f72bb682e99e8565f71e:2:74239)
    at t.useMemo (https://cocalc.com/static/load-f686fcd7daedf046f9eb.js?f72bb682e99e8565f71e:2:157829)
    at flyout (https://cocalc.com/static/app-a8f436d26aa45c7b90d2.js?f72bb682e99e8565f71e:2:5750834)
[...]

which must be happen in flyouts/files.tsx, in the useMemo, in that line:

const files: DirectoryListing = filesStore.toJS();

apparently, fileStore can be null. … and directoryListings has type any. There should be a type info for it, signalling it can be null.

ok, on a closer look, filesStore must be something else, i.e. there needs to be a check for toJS.

williamstein commented 2 months ago

My guess is some bad error path sets it to Error('...') instead of a string...