Skip to content
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

explorer fetch function refactored #2704

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

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)

src/pages/Explorer/Category/ExplorerCategory.svelte Outdated Show resolved Hide resolved
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.

2 participants