Blank page - JavaScript error on Android

##Info
Uncaught TypeError: Cannot read property ‘user’ of undefined
Url: http://example.com/assets/application-622c68bf359d79a9bf2cb12ba4772774.js
Line: 3
Column: 30623
Window Location: http://example.com/

##Backtrace

TypeError: Cannot read property 'user' of undefined
    at p.extend.s.value (http://example.com/assets/application-622c68bf359d79a9bf2cb12ba4772774.js:3:30623)
    at null.<anonymous> (http://example.com/assets/application-622c68bf359d79a9bf2cb12ba4772774.js:1:5924)
    at a.d.get (http://example.com/assets/ember_jquery-c510009d3d7cecdf3f948f54d4922d9a.js:6:25589)
    at s (http://example.com/assets/ember_jquery-c510009d3d7cecdf3f948f54d4922d9a.js:7:30860)
    at l (http://example.com/assets/ember_jquery-c510009d3d7cecdf3f948f54d4922d9a.js:7:31452)
    at Object.s [as get] (http://example.com/assets/ember_jquery-c510009d3d7cecdf3f948f54d4922d9a.js:7:30849)
    at t.get (http://example.com/assets/application-622c68bf359d79a9bf2cb12ba4772774.js:1:20436)
    at n (http://example.com/assets/application-622c68bf359d79a9bf2cb12ba4772774.js:1:18524)
    at Object.Ember.TEMPLATES.mobile/list/topic_list_item.raw.Discourse.EmberCompatHandlebars.template.1 (http://example.com/assets/application-622c68bf359d79a9bf2cb12ba4772774.js:38:16392)
    at Object.o [as inverse] (http://example.com/assets/vendor-2ff9e230f5bc60c6d19b98f79e81c3d5.js:1:8834)

##Env
application_version 3c3d7c03f0cad4067988fce6e6e776a163875ff1

##Repeatable in Chrome Dev Tools

3 Likes

You can repro this here on meta?

No, it looks data specific in that way. I have no additional plug ins and no customisations enabled.

1 Like

Debugging this still further it looks like the extras data is empty for all users

At this point t is undefined after executing the .filter - so I dumped the data in e using JSON.stringify(e):

[{
    "extras": null,
    "description": "Original Poster",
    "user_id": 10309,
    "user": {
        "id": 10309,
        "username": "andybarb",
        "avatar_template": "/user_avatar/example.com/andybarb/{size}/24058_1.png",
        "store": {}
    }
}, {
    "extras": null,
    "description": "Frequent Poster",
    "user_id": 651,
    "user": {
        "id": 651,
        "username": "CDMH",
        "avatar_template": "/user_avatar/example.com/cdmh/{size}/25343_1.png",
        "store": {}
    }
}, {
    "extras": null,
    "description": "Frequent Poster",
    "user_id": 20,
    "user": {
        "id": 20,
        "username": "Martyn",
        "avatar_template": "/user_avatar/example.com/martyn/{size}/22504_1.png",
        "store": {}
    }
}, {
    "extras": null,
    "description": "Frequent Poster",
    "user_id": 10155,
    "user": {
        "id": 10155,
        "username": "maxxbradley",
        "avatar_template": "/user_avatar/example.com/maxxbradley/{size}/21606_1.png",
        "store": {}
    }
}, {
    "extras": null,
    "description": "Frequent Poster",
    "user_id": 9929,
    "user": {
        "id": 9929,
        "username": "mark0",
        "avatar_template": "/letter_avatar_proxy/v2/letter/m/8e7dd6/{size}.png",
        "store": {}
    }
}]

##Edit - Possible Cause

I believe the cause to be a change in ownership of the last post on a topic which is listed on the forum’s latest topics.

(Hopefully) Steps to Reproduce

  • Have two existing test Users - “User 1” and “User 2”
  • Take an topic with several posts
  • the topic that caused the issue had 22 posts (inc. topic post) - created by users other than “User 1” and “User 2”
  • Make a new post in thread using “User 1”
  • this post was made 5 months later
  • Select the “User 1” post using the spanner and then using “Select Posts…”
  • Select “change ownership” from the menu which just appeared.
  • Change the owner user from “User 1” to “User 2”
  • Delete “User 1”.

##Expected Result

  • Forum to still load on Android and Desktop browsers alike.

##Actual Result

  • White / Blank screen when loaded on Android.
  • Loads and works correctly on Desktop Chrome browser.
6 Likes

Excellent repro see if you can also repro and correct this @techapj?

1 Like

Note, this is not an android bug,it’s a mobile Bug

This happens cause somehow we have a topic that has no latest poster.

I do not thing the client should crash out so I fixed that:

https://github.com/discourse/discourse/commit/1ff5ed4e084b73d9b7e1ed4a1a624282a9970a12

We should also clean up the “cast of characters” better in the case of user removals.

The bug in the OP is fixed

5 Likes

This topic was automatically closed after 6 hours. New replies are no longer allowed.