mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Minor fixes
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect, useRef, useState } from "react"
|
import React, { useEffect, useMemo, useRef } from "react"
|
||||||
import { getContextMenuOptions, ContextMenuOptionType, ContextMenuQueryItem } from "../utils/mention-context"
|
import { ContextMenuOptionType, ContextMenuQueryItem, getContextMenuOptions } from "../utils/mention-context"
|
||||||
import { formatFilePathForTruncation } from "./CodeAccordian"
|
import { formatFilePathForTruncation } from "./CodeAccordian"
|
||||||
|
|
||||||
interface ContextMenuProps {
|
interface ContextMenuProps {
|
||||||
@@ -21,14 +21,12 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
|
|||||||
selectedType,
|
selectedType,
|
||||||
queryItems,
|
queryItems,
|
||||||
}) => {
|
}) => {
|
||||||
const [filteredOptions, setFilteredOptions] = useState<ContextMenuQueryItem[]>(
|
|
||||||
getContextMenuOptions(searchQuery, selectedType, queryItems)
|
|
||||||
)
|
|
||||||
const menuRef = useRef<HTMLDivElement>(null)
|
const menuRef = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
useEffect(() => {
|
const filteredOptions = useMemo(
|
||||||
setFilteredOptions(getContextMenuOptions(searchQuery, selectedType, queryItems))
|
() => getContextMenuOptions(searchQuery, selectedType, queryItems),
|
||||||
}, [searchQuery, selectedType, queryItems])
|
[searchQuery, selectedType, queryItems]
|
||||||
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (menuRef.current) {
|
if (menuRef.current) {
|
||||||
@@ -120,6 +118,7 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
|
|||||||
maxHeight: "200px",
|
maxHeight: "200px",
|
||||||
overflowY: "auto",
|
overflowY: "auto",
|
||||||
}}>
|
}}>
|
||||||
|
{/* Can't use virtuoso since it requires fixed height and menu height is dynamic based on # of items */}
|
||||||
{filteredOptions.map((option, index) => (
|
{filteredOptions.map((option, index) => (
|
||||||
<div
|
<div
|
||||||
key={`${option.type}-${option.value || index}`}
|
key={`${option.type}-${option.value || index}`}
|
||||||
|
|||||||
Reference in New Issue
Block a user