🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(table-presets): add default option that clears saved view (#9947)
marliessophie0706c98a115b
diff --git a/web/src/components/table/table-view-presets/components/data-table-view-presets-drawer.tsx b/web/src/components/table/table-view-presets/components/data-table-view-presets-drawer.tsxindex 2bcff872c4..64d61ffb67 100644--- a/web/src/components/table/table-view-presets/components/data-table-view-presets-drawer.tsx+++ b/web/src/components/table/table-view-presets/components/data-table-view-presets-drawer.tsx@@ -79,6 +79,20 @@ import { useUniqueNameValidation } from "@/src/hooks/useUniqueNameValidation";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";+interface SystemPreset {+ id: string;+ name: string;+ isSystem: true;+}++const SYSTEM_PRESETS: { DEFAULT: SystemPreset } = {+ DEFAULT: {+ id: "__langfuse_default__",+ name: "My view",+ isSystem: true,+ },+};+interface TableViewPresetsDrawerProps {viewConfig: {tableName: TableViewPresetTableName;@@ -153,6 +167,12 @@ export function TableViewPresetsDrawer({});const handleSelectView = async (viewId: string) => {+ // Handle system preset - just select it like any view+ if (viewId === SYSTEM_PRESETS.DEFAULT.id) {+ handleSetViewId(null);+ return;+ }+capture("saved_views:view_selected", {tableName,viewId,@@ -313,11 +333,7 @@ export function TableViewPresetsDrawer({rel="noopener noreferrer"className="inline-flex items-center"title="Saving table view presets is currently in beta. Click here to provide feedback!"- >- <span className="rounded bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground">- Beta- </span>- </a>+ ></a></DrawerTitle><DrawerClose asChild><Button variant="outline" size="icon">@@ -338,6 +354,27 @@ export function TableViewPresetsDrawer({<CommandList><CommandEmpty>No saved table views found</CommandEmpty><CommandGroup className="pb-0">+ {/* System Preset: Langfuse Default */}+ <CommandItem+ key={SYSTEM_PRESETS.DEFAULT.id}+ onSelect={() => handleSelectView(SYSTEM_PRESETS.DEFAULT.id)}+ className={cn(+ "group mt-1 flex cursor-pointer items-center justify-between rounded-md p-2 transition-colors hover:bg-muted/50",+ selectedViewId === null && "bg-muted font-medium",+ )}+ title="Reflects your current table settings without applying any saved custom table views"+ >+ <div className="flex flex-col">+ <span className="text-sm font-medium text-muted-foreground">+ {SYSTEM_PRESETS.DEFAULT.name}+ </span>+ <span className="w-fit pl-0 text-xs text-muted-foreground">+ Your working view+ </span>+ </div>+ </CommandItem>++ {/* User Presets */}{TableViewPresetsList?.map((view) => (<CommandItemkey={view.id}@@ -543,7 +580,7 @@ export function TableViewPresetsDrawer({className="w-full justify-start px-1"><Plus className="mr-2 h-4 w-4" />- Create New View+ Create Custom View</Button></div></div>diff --git a/web/src/components/table/table-view-presets/hooks/useTableViewManager.ts b/web/src/components/table/table-view-presets/hooks/useTableViewManager.tsindex e8919c387e..281c73608c 100644--- a/web/src/components/table/table-view-presets/hooks/useTableViewManager.ts+++ b/web/src/components/table/table-view-presets/hooks/useTableViewManager.ts@@ -66,6 +66,12 @@ export function useTableViewManager({// Keep track of the viewId in session storage and in the query paramsconst handleSetViewId = useCallback((viewId: string | null) => {+ if (viewId === null) {+ // When clearing, remove from URL first to prevent sync loop+ const url = new URL(window.location.href);+ url.searchParams.delete("viewId");+ window.history.replaceState({}, "", url.toString());+ }setStoredViewId(viewId);setSelectedViewId(viewId);},