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 @@ -89,7 +89,13 @@ export const getConnections = async (
_userId: string,
encryptionKey: CryptoKey
): Promise<SavedConnection[]> => {
const raw = (await proxyRequest<ConnectionRaw[]>("GET", "/api/v1/nosql/connections")) ?? [];
const rawAll = (await proxyRequest<ConnectionRaw[]>("GET", "/api/v1/nosql/connections")) ?? [];
// Drop malformed rows — any item missing `id`/`encryptedData`/`iv` would crash
// downstream renders that key off `conn.id`.
const raw = rawAll.filter(
(c): c is ConnectionRaw =>
!!c && typeof c === "object" && typeof c.id === "string" && !!c.encryptedData && !!c.iv
);

const results = await Promise.allSettled(
raw.map(async (conn): Promise<SavedConnection> => {
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/components/nosql-explorer/explorer-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ export function ExplorerSidebar({
const matchesSearch = (text: string) => text.toLowerCase().includes(searchQuery.toLowerCase());

const filteredConnections = connections.filter(node => {
// Drop malformed nodes — any entry missing `connection.id` would crash
// the renderer (which reads `node.connection.id` as the React key).
if (!node?.connection || typeof node.connection.id !== "string") return false;
if (!searchQuery) return true;
if (matchesSearch(node.connection.name)) return true;

Expand Down
6 changes: 5 additions & 1 deletion apps/web/src/components/nosql-explorer/tab-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ export function TabBar({ tabs, activeTabId, onTabChange, onTabClose, onCloseAll
return <div className="border-b h-[37px] bg-muted/10" />;
}

// Defensive: filter out malformed entries — a single undefined/missing-id tab
// would crash the whole component (`tab.id` read on undefined inside .map).
const safeTabs = tabs.filter((t): t is ExplorerTab => !!t && typeof t.id === "string");

return (
<div className="flex items-center border-b bg-muted/10">
<ScrollArea className="flex-1 w-full whitespace-nowrap">
<div className="flex items-center px-1">
{tabs.map((tab) => {
{safeTabs.map((tab) => {
const isActive = activeTabId === tab.id;
const isFiltered = hasActiveQuery(tab);
return (
Expand Down