Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ function V2WorkspaceLayout() {
// mid-create before agent/terminal panes are seeded.
const isCreatePending = pendingTransaction?.type === "insert";

// Menu-driven presets bar toggle lives here, above WorkspaceProvider:
// workspaceTrpc.Provider (inside it) shares @trpc/react-query's default
// context, so electronTrpc hooks below it would resolve the host-service
// HTTP client, which does not support subscriptions.
const { toggleShowPresetsBar } = useV2UserPreferences();
electronTrpc.menu.subscribe.useSubscription(undefined, {
onData: (event) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
import { workspaceTrpc } from "@superset/workspace-client";
import { useMaybeWorkspaceClient } from "@superset/workspace-client";
import { useQuery } from "@tanstack/react-query";

const SEARCH_LIMIT = 50;

// Not a workspaceTrpc hook: the CommandPalette also mounts on v1 surfaces
// with no WorkspaceClientProvider, where those hooks throw.
export function useV2FileSearch(
workspaceId: string | undefined,
query: string,
) {
const trimmedQuery = query.trim();
const workspaceClient = useMaybeWorkspaceClient();

const { data, isFetching } = workspaceTrpc.filesystem.searchFiles.useQuery(
{
workspaceId: workspaceId ?? "",
query: trimmedQuery,
limit: SEARCH_LIMIT,
const { data, isFetching } = useQuery({
queryKey: ["v2-file-search", workspaceId ?? "", trimmedQuery],
queryFn: () => {
if (!workspaceClient) throw new Error("workspace client unavailable");
return workspaceClient.trpcClient.filesystem.searchFiles.query({
workspaceId: workspaceId ?? "",
query: trimmedQuery,
limit: SEARCH_LIMIT,
});
},
{
enabled: Boolean(workspaceId) && trimmedQuery.length > 0,
placeholderData: (previous) => previous ?? { matches: [] },
},
);
enabled:
workspaceClient !== null &&
Boolean(workspaceId) &&
trimmedQuery.length > 0,
placeholderData: (previous) => previous ?? { matches: [] },
});

const results =
data?.matches.map((match) => ({
Expand Down
1 change: 0 additions & 1 deletion packages/trpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
},
"scripts": {
"clean": "git clean -xdf .cache .turbo dist node_modules",
"test": "bun test",
"typecheck": "tsc --noEmit --emitDeclarationOnly false"
},
"dependencies": {
Expand Down
330 changes: 0 additions & 330 deletions packages/trpc/src/router/automation/automation.test.ts

This file was deleted.

Loading
Loading