Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: CodeLens workflow #147

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/events/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Careful with exports that include components, it'll cause this to compile to a large file.
import type { FileInfo } from "../features/Chat/activeFile";
// TODO: this cause more exports than needed :/
export { type ChatThread, type Chat } from "../features/Chat/Thread/types";
export {
type ChatThread,
type Chat,
type ToolUse,
} from "../features/Chat/Thread/types";
export { newChatAction } from "../features/Chat/Thread/actions";
import { type Chat } from "../features/Chat/Thread/types";
import type { Snippet } from "../features/Chat/selectedSnippet";
Expand Down Expand Up @@ -54,6 +58,7 @@ export {
ideAnimateFileStart,
ideAnimateFileStop,
ideWriteResultsToFile,
ideChatPageChange,
} from "../hooks/useEventBusForIDE";

export const fim = {
Expand Down
9 changes: 8 additions & 1 deletion src/features/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const InnerApp: React.FC<AppProps> = ({ style }: AppProps) => {
[pages],
);

const { setupHost } = useEventsBusForIDE();
const { setupHost, chatPageChange } = useEventsBusForIDE();
const tourState = useAppSelector((state: RootState) => state.tour);
const historyState = useAppSelector((state: RootState) => state.history);
const chatId = useAppSelector(selectChatId);
Expand Down Expand Up @@ -86,6 +86,13 @@ export const InnerApp: React.FC<AppProps> = ({ style }: AppProps) => {
historyState,
]);

useEffect(() => {
if (pages.length > 1) {
const currentPage = pages.slice(-1)[0];
chatPageChange(currentPage.name);
}
}, [pages, chatPageChange]);

const onPressNext = (host: Host) => {
if (host === "cloud") {
dispatch(push({ name: "cloud login" }));
Expand Down
11 changes: 11 additions & 0 deletions src/hooks/useEventBusForIDE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export const ideWriteResultsToFile = createAction<PatchResult[]>(
"ide/writeResultsToFile",
);

export const ideChatPageChange = createAction<string>("ide/chatPageChange");

import { pathApi } from "../services/refact/path";

export const useEventsBusForIDE = () => {
Expand Down Expand Up @@ -145,6 +147,14 @@ export const useEventsBusForIDE = () => {
[postMessage],
);

const chatPageChange = useCallback(
(page: string) => {
const action = ideChatPageChange(page);
postMessage(action);
},
[postMessage],
);

const [getCustomizationPath] = pathApi.useLazyCustomizationPathQuery();
const [getPrivacyPath] = pathApi.useLazyPrivacyPathQuery();
const [getBringYourOwnKeyPath] = pathApi.useLazyBringYourOwnKeyPathQuery();
Expand Down Expand Up @@ -189,5 +199,6 @@ export const useEventsBusForIDE = () => {
stopFileAnimation,
startFileAnimation,
writeResultsToFile,
chatPageChange,
};
};
Loading