Repository navigation
perf(uxcg): stop shipping unused data on UXCG pages #254
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,19 @@ | ||
| import { GetStaticProps } from 'next'; | ||
| import { useRouter } from 'next/router'; | ||
| import React, { FC, useMemo, useState } from 'react'; | ||
|
|
||
| import { QuestionType, TagType } from '@uxcore/local-types/data'; | ||
| import { TRouter } from '@uxcore/local-types/global'; | ||
|
|
||
| import { | ||
| generateQuestionsSeo, | ||
| mergeBiasesLocalization, | ||
| mergeQuestionsLocalization, | ||
| } from '@uxcore/lib/helpers'; | ||
|
|
||
| import { getStrapiBiases } from '@uxcore/api/biases'; | ||
| import { getUXCGSeo } from '@uxcore/api/mainPageSeo'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The whole import block is re-sorted into one flat list: the blank-line groups are gone and |
||
| import { getStrapiQuestions } from '@uxcore/api/questions'; | ||
| import { getTags } from '@uxcore/api/tags'; | ||
|
|
||
| import SeoGenerator from '@uxcore/components/SeoGenerator'; | ||
| import Spinner from '@uxcore/components/Spinner'; | ||
|
|
||
| import UXCGLayout from '@uxcore/layouts/UXCGLayout'; | ||
| import { | ||
| generateQuestionsSeo, | ||
| mergeQuestionsLocalization, | ||
| slimUXCGQuestions, | ||
| } from '@uxcore/lib/helpers'; | ||
| import { QuestionType, TagType } from '@uxcore/local-types/data'; | ||
| import { TRouter } from '@uxcore/local-types/global'; | ||
| import { GetStaticProps } from 'next'; | ||
| import { useRouter } from 'next/router'; | ||
| import React, { FC, useMemo, useState } from 'react'; | ||
|
|
||
| interface UxcgProps { | ||
| tags: TagType[]; | ||
|
|
@@ -72,12 +66,6 @@ export default Index; | |
| export const getStaticProps: GetStaticProps = async ({ locale }) => { | ||
| const tags = getTags(); | ||
| const questions = await getStrapiQuestions(); | ||
| const biases = await getStrapiBiases(); | ||
| const sortedBiases = mergeBiasesLocalization( | ||
| biases.en, | ||
| biases.ru, | ||
| biases.hy, | ||
| ).sort((a, b) => a.number - b.number); | ||
| // HYTranslation TODO | ||
| const sortedQuestions = mergeQuestionsLocalization( | ||
| questions.en, | ||
|
|
@@ -91,11 +79,10 @@ export const getStaticProps: GetStaticProps = async ({ locale }) => { | |
|
|
||
| return { | ||
| props: { | ||
| biases: sortedBiases, | ||
| tags, | ||
| questionsSeo, | ||
| mainSeo, | ||
| allQuestions: questions, | ||
| allQuestions: slimUXCGQuestions(questions, locale), | ||
| }, | ||
| revalidate: 5, | ||
| }; | ||
|
|
||
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.
This hunk rewrites the whole import block into one alphabetical list. It drops the grouped, blank-line-separated order that AGENTS.md describes, and it makes a perf PR's diff noisier. Please restore the original grouping and only add
slimUXCGQuestionsand remove the unusedgetStrapiBiasesandmergeBiasesLocalizationimports.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.
Tried restoring the grouped order: the file as it is on main already fails
simple-import-sort/imports("Run autofix to sort these imports!"), and the pre-commit hook runseslint --fix, so any commit touching this file re-sorts the block. The sorted order is what the repo's lint config produces; keeping it.