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: address review — hoist LogTab useMemo above early returns; pending dedup falls back to summary

Adam Eivye9419b201f7a
diff --git a/client/src/components/wiki/tabs/LogTab.jsx b/client/src/components/wiki/tabs/LogTab.jsx
index c894da8886..012c355f93 100644
--- a/client/src/components/wiki/tabs/LogTab.jsx
+++ b/client/src/components/wiki/tabs/LogTab.jsx
@@ -21,25 +21,10 @@ export default function LogTab({ vaultId, allNotes }) {
setLoading(false);
};
- if (loading) {
- return (
- <div className="flex items-center justify-center h-64">
- <RefreshCw className="w-6 h-6 text-port-accent animate-spin" />
- </div>
- );
- }
-
- if (!log) {
- return (
- <div className="flex flex-col items-center justify-center h-64 text-gray-500">
- <Clock size={32} className="mb-2 opacity-30" />
- <p className="text-sm">No activity log found</p>
- <p className="text-xs mt-1">The log is created automatically during wiki operations</p>
- </div>
- );
- }
-
+ // Hooks must run unconditionally — compute entries first (defaulting to []
+ // when log is not yet loaded) and branch into loading/empty states afterwards.
const entries = useMemo(() => {
+ if (!log) return [];
const result = [];
const lines = (log.body || log.content || '').split('\n');
let currentEntry = null;
@@ -63,6 +48,24 @@ export default function LogTab({ vaultId, allNotes }) {
return result;
}, [log]);
+ if (loading) {
+ return (
+ <div className="flex items-center justify-center h-64">
+ <RefreshCw className="w-6 h-6 text-port-accent animate-spin" />
+ </div>
+ );
+ }
+
+ if (!log) {
+ return (
+ <div className="flex flex-col items-center justify-center h-64 text-gray-500">
+ <Clock size={32} className="mb-2 opacity-30" />
+ <p className="text-sm">No activity log found</p>
+ <p className="text-xs mt-1">The log is created automatically during wiki operations</p>
+ </div>
+ );
+ }
+
const typeColors = {
init: 'text-port-accent',
ingest: 'text-port-success',
diff --git a/server/services/memoryExtractor.js b/server/services/memoryExtractor.js
index d1cc8bc95d..1e6eb9ce24 100644
--- a/server/services/memoryExtractor.js
+++ b/server/services/memoryExtractor.js
@@ -175,11 +175,17 @@ async function findExistingDuplicate(embedding, content, pendingMemories) {
}
}
- // Also check pending_approval memories (searchMemories only returns active)
+ // Also check pending_approval memories (searchMemories only returns active).
+ // Note: getMemories() returns index/summary rows without `content`, so we
+ // compare against `summary` (which we also normalize on the incoming memory
+ // for a reasonable cross-match). This keeps the dedup cheap without an
+ // extra round-trip to load full bodies.
if (pendingMemories.length > 0) {
- const normalizedContent = normalizeText(content).substring(0, 80);
+ const normalizedIncoming = normalizeText(content).substring(0, 80);
for (const mem of pendingMemories) {
- if (normalizeText(mem.content).substring(0, 80) === normalizedContent) {
+ const memText = mem.content || mem.summary || '';
+ if (!memText) continue;
+ if (normalizeText(memText).substring(0, 80) === normalizedIncoming) {
return mem;
}
}