fix: [code-421]: fix image carousel and yarn checks

This commit is contained in:
calvin 2023-06-02 14:34:06 -06:00
parent 674dcc11d2
commit 742beda319
11 changed files with 17 additions and 18 deletions

View File

@ -24,11 +24,11 @@ export function MarkdownViewer({ source, className, maxHeight }: MarkdownViewerP
const interceptClickEventOnViewerContainer = useCallback(
event => {
const { target } = event
const imageArray = source.split('\n').filter(string => string.includes('![image]'))
const imgPattern = /!\[.*?\]\((.*?)\)/;
const imageArray = source.split('\n').filter(string => imgPattern.test(string))
const imageStringArray = imageArray.map(string => {
const imageSrc = string.split('![image]')[1]
return imageSrc.slice(1, imageSrc.length - 1)
const match = string.match(imgPattern);
return match ? match[1] : '';
})
setImageEvent(imageStringArray)

View File

@ -40,7 +40,7 @@ export const ResourceListingPagination: React.FC<ResourceListingPaginationProps>
setPage(_page)
updateQueryParams({ page: _page.toString() })
},
[setPage, scrollTop]
[setPage, scrollTop] // eslint-disable-line react-hooks/exhaustive-deps
)
return totalItems ? (

View File

@ -54,7 +54,7 @@ export default function PullRequests() {
useEffect(() => {
updateQueryParams({ page: page.toString() })
}, [setPage])
}, [setPage]) // eslint-disable-line react-hooks/exhaustive-deps
const { repoMetadata, error, loading, refetch } = useGetRepositoryMetadata()
const {

View File

@ -60,7 +60,7 @@ export default function RepositoriesListing() {
useEffect(() => {
setSearchTerm(undefined)
updateQueryParams({ page: page.toString() })
}, [space, setPage])
}, [space, setPage]) // eslint-disable-line react-hooks/exhaustive-deps
const columns: Column<TypesRepository>[] = useMemo(
() => [

View File

@ -29,10 +29,10 @@ import { useCommitModal } from 'components/CommitModalButton/CommitModalButton'
import { useStrings } from 'framework/strings'
import { OptionsMenuButton } from 'components/OptionsMenuButton/OptionsMenuButton'
import { PlainButton } from 'components/PlainButton/PlainButton'
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
import { Readme } from '../FolderContent/Readme'
import { GitBlame } from './GitBlame'
import css from './FileContent.module.scss'
import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
enum FileSection {
CONTENT = 'content',
@ -104,7 +104,7 @@ export function FileContent({
return { disabled: perms.disabled, tooltip: perms.tooltip }
}
return { disabled: isRefATag(gitRef) || false, tooltip: undefined }
}, [permPushResult, gitRef])
}, [permPushResult, gitRef]) // eslint-disable-line react-hooks/exhaustive-deps
return (
<Container className={css.tabsContainer}>

View File

@ -64,7 +64,7 @@ function ReadmeViewer({ metadata, gitRef, readmeInfo, contentOnly, maxWidth }: F
return { disabled: perms.disabled, tooltip: perms.tooltip }
}
return { disabled: (gitRef && isRefATag(gitRef)) || false, tooltip: undefined }
}, [permPushResult, gitRef])
}, [permPushResult, gitRef]) // eslint-disable-line react-hooks/exhaustive-deps
return (
<Container

View File

@ -45,7 +45,7 @@ export function RepositoryBranchesContent({ repoMetadata }: Pick<GitInfoProps, '
useEffect(() => {
updateQueryParams({ page: page.toString() })
}, [setPage])
}, [setPage]) // eslint-disable-line react-hooks/exhaustive-deps
useShowRequestError(error)

View File

@ -44,7 +44,7 @@ export default function RepositoryCommits() {
useEffect(() => {
updateQueryParams({ page: page.toString() })
}, [setPage])
}, [setPage]) // eslint-disable-line react-hooks/exhaustive-deps
return (
<Container className={css.main}>

View File

@ -2,10 +2,9 @@ import React, { useEffect, useState } from 'react'
import { Container } from '@harness/uicore'
import { useGet } from 'restful-react'
import { useHistory } from 'react-router-dom'
import { noop } from 'lodash-es'
import type { RepoCommitTag } from 'services/code'
import { usePageIndex } from 'hooks/usePageIndex'
import { LIST_FETCHING_LIMIT, permissionProps, voidFn,PageBrowserProps } from 'utils/Utils'
import { LIST_FETCHING_LIMIT, permissionProps,PageBrowserProps } from 'utils/Utils'
import { useQueryParams } from 'hooks/useQueryParams'
import { useUpdateQueryParams } from 'hooks/useUpdateQueryParams'
import { useAppContext } from 'AppContext'
@ -51,7 +50,7 @@ export function RepositoryTagsContent({ repoMetadata }: Pick<GitInfoProps, 'repo
useEffect(() => {
updateQueryParams({ page: page.toString() })
}, [setPage])
}, [setPage]) // eslint-disable-line react-hooks/exhaustive-deps
useShowRequestError(error)
const space = useGetSpaceParam()

View File

@ -201,7 +201,7 @@ export function TagsContent({ repoMetadata, searchTerm = '', branches, onDeleteS
}
}
],
[
[ // eslint-disable-line react-hooks/exhaustive-deps
getString,
repoMetadata.default_branch,
repoMetadata.path,
@ -210,7 +210,7 @@ export function TagsContent({ repoMetadata, searchTerm = '', branches, onDeleteS
history,
onDeleteSuccess,
divergence
]
] // eslint-disable-line react-hooks/exhaustive-deps
)
return (

View File

@ -70,7 +70,7 @@ export default function Webhooks() {
})
useEffect(() => {
updateQueryParams({ page: page.toString() })
}, [setPage])
}, [setPage]) // eslint-disable-line react-hooks/exhaustive-deps
const columns: Column<OpenapiWebhookType>[] = useMemo(
() => [