open-learning-exchange / planet

🌍 Planet Learning - Angular application
https://hub.docker.com/r/treehouses/planet
GNU Affero General Public License v3.0
59 stars 38 forks source link

TeamsView: Resource error on first load #6626

Open paulbert opened 4 years ago

paulbert commented 4 years ago

Current Behavior

When viewing a team shared from a community on a nation, no team visits show up for the members

Desired Behavior

The visits to the team should show up for each member, if there are any. Not sure, but this may be a syncing issue.

paulbert commented 4 years ago

Did a little more testing, the visits only do not show the first time if there are specific resources there (not sure if it's ones that don't exist on the nation, or ones that do but aren't fetched in the first 1,000). The following error is thrown and the team doesn't fully load:

image

robinGiri commented 4 years ago

@paulbert, @lmmrssa and @singharpita while looking into this issue. There are few Resources which are casing problem How to create survey New Resource , New Resource , New Resource!. If we remove these Resources and reload the page there is no console error. If we add these Resources to any other team and reload the page we have console error. I have compared these Resources with other Resources and I can't find any difference in them. I can't find what is causing this error. Can you help me out?

paulbert commented 4 years ago

The TeamsService uses StateService to fetch the resource data, but that will fetch 1000 at a time and return each time.

We could try in line 223 of TeamsService to remove the || {}, allowing the resource property to be undefined if it's not found in the resources array.

Otherwise we'll need to create an option getCouchState to wait until all documents have been received.