Skip to content

Trying to access chatMessages before data present #9038

@geekgonecrazy

Description

@geekgonecrazy

Description:

Occasionally you'll reload and you'll just get a white screen. Some times it'll take several reloads before it loads the page.

Boils down to this:

[Error] TypeError: undefined is not an object (evaluating 'chatMessages[u.openedRoom].input')
	(anonymous function) 

Taking a look at: https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/rocketchat-ui-message/client/messageBox.js#L470

This makes sense. Basically onRendered in this template is called before chatMessages has even been defined or populated.

Some times data loading is fast enough that this doesn't happen. But when there is a slight delay the data isn't there in time.

Server Setup Information:

  • Version of Rocket.Chat Server: 0.59.0+

Steps to Reproduce:

  1. Put server under some load
  2. Refresh like mad
  3. Hope the condition hits.

Expected behavior:

Should either wait for this data... or should at least verify there before trying to access it.

Actual behavior:

Blank page

Relevant logs:

[Error] TypeError: undefined is not an object (evaluating 'chatMessages[u.openedRoom].input')
	(anonymous function) (f79e342366a21ea0345d878e108dbcceb4008c06.js:245:54875)

Metadata

Metadata

Labels

area: ui/uxRelated to UI/UX, frontend code, accessibility, and user interactiontype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions