Skip to content

Conversation

@peratik
Copy link
Contributor

@peratik peratik commented Jan 18, 2023

Changes

  • explorer fetch function refactored

Notion's card

Checklist

  • I've performed a self-review, followed all rules from Frontend style guide
  • If I make changes to another person's module, I've asked how to use it or request a review
  • I've updated the documentation, if necessary (Keyboard shortcuts, Account settings)
  • I've checked night mode, mobile & tablet screens (if have changes in UI)
  • I've added tests (if necessary)

Screenshots or GIFs

@peratik peratik self-assigned this Jan 18, 2023
Comment on lines 82 to 93
async function setInsightItems() {
if (activeMenu !== MenuItem.TRENDING) return
const insightItems = await queryExplorerItems({
types: [EntityKeys.INSIGHT],
page: insightsPage,
})
insightsPages = insightItems.pages
insights = insightsPage === 1 ? insightItems.items : insights.concat(insightItems.items)
}
async function setDisplayingItems() {
const displayingItems = await queryExplorerItems({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @Woafflation described, separate insights' query was added as hotfix to support insights in the feed. Now it is not required, since it's natively supported by the api.

queryExplorerItems({
types: [EntityKeys.INSIGHT],
page: insightsPage,
})
.then((res) => {
if (activeMenu === MenuItem.TRENDING) {
insightsPages = res.pages
insights = insightsPage === 1 ? res.items : insights.concat(res.items)
}
})
.catch(() => notifyError({ user: $currentUser }))
.finally(() => {
queryExplorerItems({
types: getDisplayingType(displayingTypes),

The inisght specific query function can be removed (LOC 82)

Copy link
Member

@DmitriVanGuard DmitriVanGuard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will merge this PR a little bit later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants