Closed fadeev closed 4 years ago
I've located the source of the error to the following line in App.vue:
this.following.map(address => this.fetchMemosFromAddress(address));
This line makes the user fetch memos uncontrollably. This line also doesn't make sense, because map
returns an array of undefined
, which gets discarded. fetchMemosFromAddress
produces side-effects, and I assume forEach
was meant to be used to fetch memos for each address. This does not solve the problem above, however.
To fix this I propose we delegate the important task of fetching memos and other page-specific data to pages themselves (and avoid doing that globally in App.vue). For example, a profile page will dispatch events to fetch memos required for this page (and nothing more). So will the home page. BtnLoadMore
on the other hand, should be a presentational component and should not be dispatching Vuex events, but rather should send events to whatever parent it has, so that the parent can handle data fetching.
To start doing this, it's important to be able to fetch only the right data, for example, in AccountsAccount.vue
:
this.$store.dispatch("memos/fetchAndAdd", {
limit: 10,
orderBy: ["timestamp", "desc"],
where: [
["address", "==", this.$route.params.address],
["type", "==", "post"]
]
});
Fetching posts made from a specific address. I've added ["type", "==", "post"]
, but if fails:
https://github.com/virgo-project/dither/tree/fadeev/fetching
@nylira would like to hear your thoughts on this! If you agree, we should create indexes, so we can query data more precisely (I don't have permissions to do this).
Hey Denis, I'm happy to create this index to so that you can resolve this bug. Can you give me the exact Firebase URL from your Chrome console?
It's ready to go
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
There is a bug with fetching memos.
To reproduce visit a user profile and open Vue devtools. Notice that there are over 100 memos in Vuex, although the profile may only show 10.
That's not perfect (a user should not have to download memos that he doesn't see on the page), but it becomes a problem after visiting other pages or even waiting for a short while. Either devtools blow up (this happens so often to me, that it makes it hard to debug the app):
Or call stack error is raised: