New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TipsPagination: Combine data fetching, fetch simultaneously #691
Conversation
|
||
this.tips = await Util.range(1, this.page) | ||
.asyncMap(async (page) => Backend | ||
.getCacheTips(this.tipSortBy, page, this.address, this.search, this.blacklist)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thepiwo Was it intentional to make these requests one by one instead of doing them at the same time? I don't think that something can go wrong if the client will request them at the same time, except it has 100 pages opened or so. Also, it can be handled by the backend allowing to accept page range.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my goal here was to get the order right without much code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But could probably be done using Promise all as well
3041799
to
76929b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good. @davidyuk can you resolve conflicts?
src/components/TipsPagination.vue
Outdated
@@ -28,12 +28,11 @@ | |||
</template> | |||
|
|||
<script> | |||
import { get, isEmpty } from 'lodash-es'; | |||
import { get, isEmpty, times } from 'lodash-es'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer not to use lodash at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why so? I'm using it in edge cases when js doesn't have something out of the box. Also lodash-es
uses es6 imports so only used code will appear in the bundle. Or maybe you prefer to use ramda instead? 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a specific reason, I don't think lodash is needed really. Up to you to decide
src/components/TipsPagination.vue
Outdated
}); | ||
|
||
this.interval = setInterval(() => this.reloadData(), 120 * 1000); | ||
this.interval = setInterval(() => this.loadData(), 120 * 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name reloadData
was consistent across components
76929b0
to
d19d08f
Compare
No description provided.