Skip to content

Commit

Permalink
fix jumping cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
angorayc committed Jun 28, 2024
1 parent e63e692 commit 7c30b20
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ export const SystemPromptEditorComponent: React.FC<Props> = ({
}) => {
// Prompt
const promptContent = useMemo(
() => selectedSystemPrompt?.content ?? '',
[selectedSystemPrompt?.content]
// Fixing Cursor Jump in text area
() => systemPromptSettings.find((sp) => sp.id === selectedSystemPrompt?.id)?.content ?? '',
[selectedSystemPrompt?.id, systemPromptSettings]
);

const handlePromptContentChange = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ const QuickPromptSettingsEditorComponent = ({
const { basePromptContexts } = useAssistantContext();

// Prompt
const prompt = useMemo(() => selectedQuickPrompt?.prompt ?? '', [selectedQuickPrompt?.prompt]);
const prompt = useMemo(
// Fixing Cursor Jump in text area
() => quickPromptSettings.find((p) => p.title === selectedQuickPrompt?.title)?.prompt ?? '',
[selectedQuickPrompt?.title, quickPromptSettings]
);

const handlePromptChange = useCallback(
(e: React.ChangeEvent<HTMLTextAreaElement>) => {
Expand Down

0 comments on commit 7c30b20

Please sign in to comment.