← back to Norma
fix(types): unblock SocialTab render, IntegrationsTab metadata, credentials rowCount null
720506c12ddb3a6dbed66d2dae78b8fe852f1ee5 · 2026-05-20 01:58:27 -0700 · Steve Abrams
3 fixes for issues found via tsc pre-flight before tomorrow's QA:
1. components/social/SocialTab.tsx — define local CATEGORY_COLORS map at top
of file. Was being referenced at lines 3298,3299 without import; would
throw ReferenceError on social tab render. Same palette as the existing
defs in components/graph/PartnerTree.tsx + IdeaMindMap.tsx. If we expand
the palette later, lift this to a shared lib/category-colors.ts.
2. components/IntegrationsTab.tsx:257 — wrap metadata.workspace_name
conditional in ternary instead of && so React's ReactNode contract is
satisfied. The && form was leaving 'unknown' in the children array.
3. lib/credentials.ts:178 revokeApiKey — handle nullable rowCount via
nullish coalescing. Previous code would TypeError if pg returned null
rowCount on an UPDATE-RETURNING with zero matches.
Files touched
M components/IntegrationsTab.tsxM components/social/SocialTab.tsxM lib/credentials.ts
Diff
commit 720506c12ddb3a6dbed66d2dae78b8fe852f1ee5
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed May 20 01:58:27 2026 -0700
fix(types): unblock SocialTab render, IntegrationsTab metadata, credentials rowCount null
3 fixes for issues found via tsc pre-flight before tomorrow's QA:
1. components/social/SocialTab.tsx — define local CATEGORY_COLORS map at top
of file. Was being referenced at lines 3298,3299 without import; would
throw ReferenceError on social tab render. Same palette as the existing
defs in components/graph/PartnerTree.tsx + IdeaMindMap.tsx. If we expand
the palette later, lift this to a shared lib/category-colors.ts.
2. components/IntegrationsTab.tsx:257 — wrap metadata.workspace_name
conditional in ternary instead of && so React's ReactNode contract is
satisfied. The && form was leaving 'unknown' in the children array.
3. lib/credentials.ts:178 revokeApiKey — handle nullable rowCount via
nullish coalescing. Previous code would TypeError if pg returned null
rowCount on an UPDATE-RETURNING with zero matches.
---
components/IntegrationsTab.tsx | 2 +-
components/social/SocialTab.tsx | 21 +++++++++++++++++++++
lib/credentials.ts | 2 +-
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/components/IntegrationsTab.tsx b/components/IntegrationsTab.tsx
index 4681685..b5f7065 100644
--- a/components/IntegrationsTab.tsx
+++ b/components/IntegrationsTab.tsx
@@ -254,7 +254,7 @@ function ServiceCard({ service, index, onToggle, onTest }: {
{/* Metadata row */}
{connected && (
<div className="flex items-center gap-4" style={{ marginTop: 6, fontSize: 11, color: 'var(--color-text-muted)' }}>
- {service.metadata.workspace_name && <span>{service.metadata.workspace_name as string}</span>}
+ {service.metadata.workspace_name ? <span>{service.metadata.workspace_name as string}</span> : null}
{service.last_synced_at && <span>Synced {timeAgo(service.last_synced_at)}</span>}
{service.connected_at && <span>Connected {timeAgo(service.connected_at)}</span>}
</div>
diff --git a/components/social/SocialTab.tsx b/components/social/SocialTab.tsx
index 134dda1..fdae3da 100644
--- a/components/social/SocialTab.tsx
+++ b/components/social/SocialTab.tsx
@@ -19,6 +19,27 @@ import AIImageGenerator from './phase2/AIImageGenerator';
import BulkScheduleModal from './phase2/BulkScheduleModal';
import MyPostsTab from './phase2/MyPostsTab';
+/* ─────────────────────────────────────────────────────────────────────────── */
+/* CONSTANTS */
+/* ─────────────────────────────────────────────────────────────────────────── */
+
+/**
+ * Category → display color. Same palette used in components/graph/PartnerTree.tsx
+ * and components/graph/IdeaMindMap.tsx. Defined here so SocialTab renders without
+ * referencing those graph-only files. If you need to expand the palette, lift
+ * this map into a shared lib/category-colors.ts.
+ */
+const CATEGORY_COLORS: Record<string, string> = {
+ student_debt: '#ef4444',
+ education: '#6366f1',
+ economy: '#eab308',
+ health: '#22c55e',
+ policy: '#8b5cf6',
+ civil_rights: '#f59e0b',
+ housing: '#06b6d4',
+ workforce: '#ec4899',
+};
+
/* ─────────────────────────────────────────────────────────────────────────── */
/* TYPES */
/* ─────────────────────────────────────────────────────────────────────────── */
diff --git a/lib/credentials.ts b/lib/credentials.ts
index 8204bc4..2b2dcf0 100644
--- a/lib/credentials.ts
+++ b/lib/credentials.ts
@@ -175,7 +175,7 @@ export async function revokeApiKey(id: string): Promise<boolean> {
'UPDATE norma_api_keys SET is_active = false WHERE id = $1 RETURNING id',
[id],
);
- return result.rowCount > 0;
+ return (result.rowCount ?? 0) > 0;
}
/* ─── Social Platform Credentials ────────────────────────────────────────── */
← ddf268e instagram-agent: enable live reel/story/post publishing via
·
back to Norma
·
fix(pulse-public): silence 401 spam, unblock topics for gues 52ff6c8 →