Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: route the Insights taste card to the profile when its themes fetch fails (#3787)

[._.]/ Adam Eivy3e7786d4c8a7
diff --git a/client/src/pages/Insights.jsx b/client/src/pages/Insights.jsx
index be594d023e..32c9bfa5b2 100644
--- a/client/src/pages/Insights.jsx
+++ b/client/src/pages/Insights.jsx
@@ -91,9 +91,12 @@ export function OverviewTab() {
// Taste-Identity card data
const themesAvailable = themesData?.available;
const firstTheme = themesAvailable ? themesData.themes?.[0] : null;
- // A missing taste profile is a prerequisite the user fills elsewhere; anything
- // else just means themes haven't been generated from it yet.
- const needsTasteProfile = !themesAvailable && themesData?.reason === 'no_taste_data';
+ // A missing taste profile is a prerequisite the user fills elsewhere; only an
+ // explicit `not_generated` means the profile is there and just needs themes.
+ // Anything else — including a failed fetch, where `themesData` is null — routes
+ // to the profile, which is harmless either way, rather than offering a generate
+ // that would fail for a user with no profile.
+ const needsTasteProfile = !themesAvailable && themesData?.reason !== 'not_generated';
// Cross-Domain card data
const narrativeAvailable = narrativeData?.available;
@@ -204,7 +207,9 @@ export function OverviewTab() {
<div className="text-xl font-bold text-white mb-1">{stat}</div>
- <p className="text-xs text-gray-400 leading-relaxed line-clamp-2">{topInsight}</p>
+ {/* A <span> rather than a <p>: only phrasing content is valid
+ inside the <button> this summary sits in. */}
+ <span className="block text-xs text-gray-400 leading-relaxed line-clamp-2">{topInsight}</span>
</button>
<div className="flex items-center justify-between mt-3">
diff --git a/client/src/pages/Insights.test.jsx b/client/src/pages/Insights.test.jsx
index 13a51f4529..364b37ae9d 100644
--- a/client/src/pages/Insights.test.jsx
+++ b/client/src/pages/Insights.test.jsx
@@ -61,6 +61,15 @@ describe('Insights OverviewTab empty cards', () => {
expect(navigateMock).toHaveBeenCalledWith('/digital-twin/taste');
});
+ it('falls back to the taste-profile deep link when the themes fetch fails', async () => {
+ // A rejected fetch leaves `themesData` null — offering "Generate themes"
+ // there would fail for anyone who has no profile yet.
+ getInsightThemes.mockResolvedValue(null);
+ renderOverview();
+ expect(await screen.findByText('Complete taste profile')).toBeTruthy();
+ expect(screen.queryByText('Generate themes')).toBeNull();
+ });
+
it('generates themes in place once a taste profile exists', async () => {
getInsightThemes.mockResolvedValue({ available: false, reason: 'not_generated' });
refreshInsightThemes.mockResolvedValue({