Closed Bug 752961 Opened 12 years ago Closed 12 years ago

Calling social:reload adds duplicates to the social items

Categories

(Pancake Graveyard :: Front-end, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: st3fan, Assigned: sfoster)

References

Details

When the pull-to-refresh is done, the ios app sends social:reload to the FE. It correctly goes to twitter and facebook to grab new items but it incorrectly just prepends them to the current items. Instead it should only add new items that are not already on the page.
If the iOS app needs to send a different call to the FE then that is of course also possible. Since we already use social:reload to notify the FE about changes in the social settings. Not sure if that is the cause.
Do we want to fetch more (additive) or refresh the list? social:reload sounds like we want to empty the existing list and repopulate it by fetching again. So stuff currently on the screen may go away.
Maybe start with a simple refresh and do something more sophisticated with the social items later? LIke we could add a 'more tweets' button at the bottom, things like that.
Assignee: nobody → sfoster
Seems like the pull-to-refresh in the main window currently fully reloads the app - top, main and drawer is that right?
Hmm it only sends a reload to the main webview. Not to any of the others.

Btw if the page reload is not a good idea then it is easy to revert back to the app sending a command to the FE instead.
The behavior we want here is for refresh of whatever-is-currently-on-the-screen. 
So, searches should be re-submitted, social feeds refreshed, etc. 

Commits: 
https://bitbucket.org/mozillapancake/pancake/changeset/bc64aa3677a1
https://bitbucket.org/mozillapancake/pancake/changeset/a0b20598e90d

.. wire a handler for a 'refresh' message to make this so for the home screen (top_stacks + social) and the search (search/search+terms). If we sendMessage('main', 'refresh', [{}]) from the pull-to-refresh gesture, it should do what we want.
Assignee: sfoster → sarentz
When I send refresh to main I get the following error:

2012-06-05 14:32:54.527 PancakeDevelopment[15591:f803] LOG - MAIN - "main (ios): handling  xmessage: refresh"
2012-06-05 14:32:54.528 PancakeDevelopment[15591:f803] LOG - MAIN - "main: xmessage, calling handler: onRefresh"
2012-06-05 14:32:54.529 PancakeDevelopment[15591:f803] LOG - MAIN - "refresh instruction received, reload: undefined"
2012-06-05 14:32:54.536 PancakeDevelopment[15591:f803] LOG - MAIN - "main: refresh result: \"null\""

I have committed this change anyway, so that you can update your iOS app to test it.
Assignee: sarentz → sfoster
I reinstated the social:reload message handler in main-bb, so toggling social services in the account menu will now refresh the social feed (and the top stacks too). 

The error messages you saw aren't really errors, just logging. I've fixed it so we don't get that undefined and also made the xmessage return value logging conditional on there being a return value at all.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
See changeset: https://bitbucket.org/mozillapancake/pancake/changeset/f19b02957150

(In reply to Sam Foster [:sfoster] from comment #8)
> I reinstated the social:reload message handler in main-bb, so toggling
> social services in the account menu will now refresh the social feed (and
> the top stacks too).
You need to log in before you can comment on or make changes to this bug.