Skip to content

Commit

Permalink
refactor(ui): all multi line if shall be curly (#2901)
Browse files Browse the repository at this point in the history
* refactor(ui): all multi line if shall be curly

* update

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
wsxiaoys and autofix-ci[bot] authored Aug 17, 2024
1 parent 512aa07 commit b559217
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions ee/tabby-ui/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"unused-imports"
],
"rules": {
"curly": ["error", "multi-line"],
"unused-imports/no-unused-imports": "error",
"tailwindcss/no-custom-classname": "off",
"import/no-restricted-paths": [
Expand Down
3 changes: 2 additions & 1 deletion ee/tabby-ui/app/files/components/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,12 @@ function resolveRepoRef(
name: string
ref: GitReference | undefined
} {
if (!ref)
if (!ref) {
return {
name: '',
ref: undefined
}
}

const regx = /refs\/(\w+)\/(.*)/
const match = ref.name.match(regx)
Expand Down
3 changes: 2 additions & 1 deletion ee/tabby-ui/components/chat/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,11 @@ function ChatRenderer(
}, [])

const chatMaxWidthClass = maxWidth ? `max-w-${maxWidth}` : 'max-w-2xl'
if (!initialized)
if (!initialized) {
return (
<ListSkeleton className={`${chatMaxWidthClass} mx-auto pt-4 md:pt-10`} />
)
}

return (
<ChatContext.Provider
Expand Down
7 changes: 4 additions & 3 deletions ee/tabby-ui/components/textarea-search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ function RepoSelect({ value, onChange, className, disabled }: RepoSelectProps) {
const repos = data?.repositoryList

const emptyText = useMemo(() => {
if (!repos?.length)
if (!repos?.length) {
return (
<div className="space-y-4 py-2">
<p className="font-semibold">No repositories</p>
Expand All @@ -247,8 +247,9 @@ function RepoSelect({ value, onChange, className, disabled }: RepoSelectProps) {
</Link>
</div>
)

return 'No results found'
} else {
return 'No results found'
}
}, [repos])

const onSelectRepo = (repo: Repository) => {
Expand Down
9 changes: 6 additions & 3 deletions ee/tabby-ui/lib/hooks/use-thread-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ export function useThreadRun({
if (
existingData?.threadAssistantMessageCreated &&
data.threadUserMessageCreated
)
) {
return data
}

return {
...existingData,
Expand Down Expand Up @@ -233,8 +234,9 @@ export function useThreadRun({
if (
createThreadAndRunResult.fetching ||
!createThreadAndRunResult?.operation
)
) {
return
}
// error handling
if (createThreadAndRunResult?.error) {
setError(createThreadAndRunResult?.error)
Expand All @@ -261,8 +263,9 @@ export function useThreadRun({
stop()
}

if (createThreadRunResult?.fetching || !createThreadRunResult?.operation)
if (createThreadRunResult?.fetching || !createThreadRunResult?.operation) {
return
}

// error handling
if (createThreadRunResult?.error) {
Expand Down

0 comments on commit b559217

Please sign in to comment.