fix: navigation bug

This commit is contained in:
Patrick Erichsen 2025-05-22 15:39:21 -07:00
parent 4f371a0eb6
commit fab53472a9
7 changed files with 5 additions and 11 deletions

View file

@ -13,7 +13,6 @@ import Shortcut from "../gui/Shortcut";
import { XMarkIcon } from "@heroicons/react/24/solid";
import { useNavigate } from "react-router-dom";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import { useNavigationListener } from "../../hooks/useNavigationListener";
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
import {
newSession,
@ -38,7 +37,6 @@ const HEADER_CLASS =
"flex user-select-none pt-2 pb-3 opacity-75 text-center font-bold items-center justify-center sticky h-6";
export function History() {
useNavigationListener();
const dispatch = useAppDispatch();
const navigate = useNavigate();
const searchInputRef = React.useRef<HTMLInputElement>(null);

View file

@ -147,6 +147,7 @@ const Layout = () => {
useWebviewListener(
"focusEdit",
async () => {
navigate(ROUTES.HOME);
await ideMessenger.request("edit/addCurrentSelection", undefined);
await dispatch(enterEdit({}));
mainEditor?.commands.focus();

View file

@ -6,7 +6,7 @@ interface ModeIconProps {
className?: string;
}
function ModeIcon({
export function ModeIcon({
mode,
className = "xs:h-3 xs:w-3 h-3 w-3",
}: ModeIconProps) {
@ -17,5 +17,3 @@ function ModeIcon({
return <ChatBubbleLeftIcon className={className} />;
}
}
export default ModeIcon;

View file

@ -13,7 +13,7 @@ import {
ListboxOption,
ListboxOptions,
} from "../ui/Listbox";
import ModeIcon from "./ModeIcon";
import { ModeIcon } from "./ModeIcon";
export function ModeSelect() {
const dispatch = useAppDispatch();
@ -76,7 +76,7 @@ export function ModeSelect() {
<div className="relative">
<ListboxButton
data-testid="mode-select-button"
className="xs:px-2 text-description-muted bg-border gap-1 rounded-full border-none px-1.5 py-0.5 transition-colors duration-200"
className="xs:px-2 text-description-muted bg-badge gap-1 rounded-full border-none px-1.5 py-0.5 transition-colors duration-200 hover:brightness-110"
>
<ModeIcon mode={mode} />
<span className="hidden sm:block">

View file

@ -81,8 +81,6 @@ export function createEditorConfig(options: {
const isStreaming = useAppSelector((state) => state.session.isStreaming);
const useActiveFile = useAppSelector(selectUseActiveFile);
const historyLength = useAppSelector((store) => store.session.history.length);
const mode = useAppSelector((store) => store.session.mode);
const modeRef = useUpdatingRef(mode);
const codeToEdit = useAppSelector((store) => store.editModeState.codeToEdit);
const isInEdit = useAppSelector((store) => store.session.isInEdit);
const isInEditRef = useUpdatingRef(isInEdit);

View file

@ -270,7 +270,7 @@ function ParallelListeners() {
);
useEffect(() => {
if (isInEdit) {
if (!isInEdit) {
dispatch(setLastNonEditSessionEmpty(history.length === 0));
}
}, [isInEdit, history]);

View file

@ -8,7 +8,6 @@ const openGUITypes: (keyof ToWebviewProtocol)[] = [
"focusContinueInput",
"focusContinueInputWithoutClear",
"newSession",
"focusEdit",
];
export const useNavigationListener = () => {