Skip to content

Commit

Permalink
fix tags input flipping between controlled/uncontrolled
Browse files Browse the repository at this point in the history
  • Loading branch information
Southclaws committed Jan 1, 2025
1 parent 5d5faf0 commit 45861a1
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export function LibraryPageTagsList<T extends FieldValues>(props: Props<T>) {
initialValue={currentTags}
onQuery={handleQuery}
onChange={handleChange}
value={field.value}
/>
{isSuggestEnabled && (
<IntelligenceAction
Expand Down
3 changes: 0 additions & 3 deletions web/src/components/ui/combotags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ import * as Combobox from "@/components/ui/combobox";
import { IconButton } from "@/components/ui/icon-button";
import * as TagsInput from "@/components/ui/tags-input";

import { CancelIcon } from "./icons/Cancel";
import { DeleteSmallIcon } from "./icons/Delete";

export type Props = {
initialValue?: string[];
value?: string[];
onQuery: (query: string) => Promise<string[]>;
onChange: (values: string[]) => Promise<void>;
};
Expand All @@ -39,7 +37,6 @@ export const Combotags = forwardRef<CombotagsHandle, Props>((props, ref) => {
// use the context provider here for easier control of the tags input values.
const tagsInput = useTagsInput({
defaultValue: props.initialValue,
value: props.value ?? props.initialValue,
inputValue: searchQuery,
addOnPaste: true,
onInputValueChange: handleInputValueChange,
Expand Down
2 changes: 1 addition & 1 deletion web/src/screens/thread/ThreadScreen/useThreadScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type Props = {
export const FormSchema = z.object({
title: z.string().min(1, "Please enter a title."),
body: z.string().min(1),
tags: z.array(z.string()),
tags: z.array(z.string()).optional(),
});
export type Form = z.infer<typeof FormSchema>;

Expand Down

0 comments on commit 45861a1

Please sign in to comment.