Remove unused imports, use a single Label fragment

This commit is contained in:
Jackson Harper 2022-03-25 14:17:02 -07:00
parent ea98d97915
commit 1784edefaf
5 changed files with 5 additions and 19 deletions

View file

@ -10,11 +10,8 @@ import { MutableRefObject, useEffect, useState } from 'react'
import { ReportIssuesModal } from './ReportIssuesModal'
import { reportIssueMutation } from '../../../lib/networking/mutations/reportIssueMutation'
import { ArticleHeaderToolbar } from './ArticleHeaderToolbar'
import { ShareArticleModal } from './ShareArticleModal'
import { userPersonalizationMutation } from '../../../lib/networking/mutations/userPersonalizationMutation'
import { webBaseURL } from '../../../lib/appConfig'
import { updateThemeLocally } from '../../../lib/themeUpdater'
import { EditLabelsModal } from './EditLabelsModal'
import { ArticleMutations } from '../../../lib/articleActions'
type ArticleContainerProps = {

View file

@ -3,8 +3,6 @@ import { makeHighlightStartEndOffset } from '../../../lib/highlights/highlightGe
import type { HighlightLocation } from '../../../lib/highlights/highlightGenerator'
import { useSelection } from '../../../lib/highlights/useSelection'
import type { Highlight } from '../../../lib/networking/fragments/highlightFragment'
import { shareHighlightToFeedMutation } from '../../../lib/networking/mutations/shareHighlightToFeedMutation'
import { shareHighlightCommentMutation } from '../../../lib/networking/mutations/updateShareHighlightCommentMutation'
import {
highlightIdAttribute,
highlightNoteIdAttribute,

View file

@ -6,6 +6,7 @@ export const labelFragment = gql`
name
color
description
createdAt
}
`

View file

@ -1,5 +1,6 @@
import { gql } from 'graphql-request'
import useSWR from 'swr'
import { Label, labelFragment } from '../fragments/labelFragment'
import { publicGqlFetcher } from '../networkHelpers'
type LabelsQueryResponse = {
@ -16,25 +17,13 @@ type LabelsData = {
labels?: unknown
}
export type Label = {
id: string
name: string
color: string
description?: string
createdAt: Date
}
export function useGetLabelsQuery(): LabelsQueryResponse {
const query = gql`
query GetLabels {
labels {
... on LabelsSuccess {
labels {
id
name
color
description
createdAt
...LabelFields
}
}
... on LabelsError {
@ -42,6 +31,7 @@ export function useGetLabelsQuery(): LabelsQueryResponse {
}
}
}
${labelFragment}
`
const { data, mutate, error, isValidating } = useSWR(query, publicGqlFetcher)

View file

@ -6,7 +6,7 @@ import { articleFragment } from '../fragments/articleFragment'
import { setLinkArchivedMutation } from '../mutations/setLinkArchivedMutation'
import { deleteLinkMutation } from '../mutations/deleteLinkMutation'
import { articleReadingProgressMutation } from '../mutations/articleReadingProgressMutation'
import { Label } from './useGetLabelsQuery'
import { Label } from './../fragments/labelFragment'
import { showErrorToast, showSuccessToast } from '../../toastHelpers'
export type LibraryItemsQueryInput = {