ForstaLabs / forsta-web-messenger

Forsta Web Messenger
GNU General Public License v3.0
4 stars 10 forks source link

TypeError: Cannot read property 'id' of undefined #348

Closed mayfield closed 4 years ago

mayfield commented 4 years ago

https://sentry.io/organizations/forsta/issues/1345873241/?referrer=github_plugin

TypeError: Cannot read property 'id' of undefined
  at i.getItem (/@static/js/app/main.min.js:173:53)
  at i.waitAdded (/@static/js/app/main.min.js:209:709)
  at i.loadMore (/@static/js/app/main.min.js:231:251)
  at async i.render (/@static/js/app/main.min.js:228:655)
  at async i.open (/@static/js/app/main.min.js:225:361)
...
(2 additional frame(s) were not displayed)
mayfield commented 4 years ago

Seems to be related to a thread who's total message count is non zero but fetchPage() yields zero results.

I can repro by inserting a single message then adding replies to it. If the original is deleted it will produce the aforementioned error.

TBD:

  1. Fix the loadMore routine to use smarter detection of page-in need.
  2. Handle the results of loadMore being empty.
  3. Tolerate exceptions during loadMore in a way that doesn't break ThreadView rendering completely. e.g. let it load the rest of the view but maybe just not be able to load the current set of messages. This way it might be easily repaired by the user themselves.
mayfield commented 4 years ago

Note, I only did line item 2 here. I can't do better on 1 without adding yet another db index and 3 wasn't justifiable considering how small that function already is. I'll just patch the bugs as they come.