From 026c1654e3a9acacd79f876249e4b684f814432e Mon Sep 17 00:00:00 2001 From: Till-JS <101404291+Till-JS@users.noreply.github.com> Date: Sun, 14 Dec 2025 21:13:22 +0100 Subject: [PATCH] fix(contacts): resolve Svelte 5 hydration error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move type exports from .svelte files to separate .types.ts files (FilterDropdown, CommandBar) to prevent SSR hydration issues - Replace direct NetworkGraph component import in network store with TypeScript interface to avoid SSR component instantiation - Add missing shared packages to vite.config.ts ssr.noExternal and optimizeDeps.exclude (splitscreen, i18n, profile-ui, etc.) The hydration error "Cannot read properties of undefined (reading 'call')" was caused by Svelte 5's stricter handling of component imports in .svelte.ts files and type exports from .svelte files during SSR. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 4.5 --- .../apps/web/src/lib/stores/network.svelte.ts | 13 +- apps/contacts/apps/web/vite.config.ts | 14 + .../src/command-bar/CommandBar.svelte | 24 +- .../src/command-bar/CommandBar.types.ts | 22 + packages/shared-ui/src/command-bar/index.ts | 2 +- .../src/molecules/FilterDropdown.svelte | 716 ++++++++++++++++++ .../src/molecules/FilterDropdown.types.ts | 8 + packages/shared-ui/src/molecules/index.ts | 2 + 8 files changed, 774 insertions(+), 27 deletions(-) create mode 100644 packages/shared-ui/src/command-bar/CommandBar.types.ts create mode 100644 packages/shared-ui/src/molecules/FilterDropdown.svelte create mode 100644 packages/shared-ui/src/molecules/FilterDropdown.types.ts diff --git a/apps/contacts/apps/web/src/lib/stores/network.svelte.ts b/apps/contacts/apps/web/src/lib/stores/network.svelte.ts index 9410ec1c6..f0d2f8ea2 100644 --- a/apps/contacts/apps/web/src/lib/stores/network.svelte.ts +++ b/apps/contacts/apps/web/src/lib/stores/network.svelte.ts @@ -17,14 +17,21 @@ import type { SimulationNode as SharedSimulationNode, SimulationLink as SharedSimulationLink, } from '@manacore/shared-ui'; -import { NetworkGraph } from '@manacore/shared-ui'; // Re-export types from shared-ui for convenience export type SimulationNode = SharedSimulationNode; export type SimulationLink = SharedSimulationLink; +// Interface for NetworkGraph component zoom methods +interface NetworkGraphZoomMethods { + zoomIn(): void; + zoomOut(): void; + resetZoom(): void; + focusOnSelectedNode(): void; +} + // Graph component reference for zoom controls -let graphComponentRef: NetworkGraph | null = null; +let graphComponentRef: NetworkGraphZoomMethods | null = null; // localStorage key for toolbar state const TOOLBAR_STORAGE_KEY = 'network-toolbar-state'; @@ -215,7 +222,7 @@ export const networkStore = { /** * Register graph component reference for zoom controls */ - setGraphComponent(component: NetworkGraph | null) { + setGraphComponent(component: NetworkGraphZoomMethods | null) { graphComponentRef = component; }, diff --git a/apps/contacts/apps/web/vite.config.ts b/apps/contacts/apps/web/vite.config.ts index 2c048d22b..12b3a0503 100644 --- a/apps/contacts/apps/web/vite.config.ts +++ b/apps/contacts/apps/web/vite.config.ts @@ -23,6 +23,13 @@ export default defineConfig({ '@manacore/shared-branding', '@manacore/shared-subscription-ui', '@manacore/shared-utils', + '@manacore/shared-splitscreen', + '@manacore/shared-i18n', + '@manacore/shared-profile-ui', + '@manacore/shared-tags', + '@manacore/shared-help-types', + '@manacore/shared-help-content', + '@manacore/shared-help-ui', ], }, optimizeDeps: { @@ -40,6 +47,13 @@ export default defineConfig({ '@manacore/shared-branding', '@manacore/shared-subscription-ui', '@manacore/shared-utils', + '@manacore/shared-splitscreen', + '@manacore/shared-i18n', + '@manacore/shared-profile-ui', + '@manacore/shared-tags', + '@manacore/shared-help-types', + '@manacore/shared-help-content', + '@manacore/shared-help-ui', ], }, }); diff --git a/packages/shared-ui/src/command-bar/CommandBar.svelte b/packages/shared-ui/src/command-bar/CommandBar.svelte index 1130c62a1..fcf39c812 100644 --- a/packages/shared-ui/src/command-bar/CommandBar.svelte +++ b/packages/shared-ui/src/command-bar/CommandBar.svelte @@ -1,5 +1,6 @@ + +
+ + + + {#if isOpen} + + + + +
+ + {#if showSearch} +
+ + + + + {#if searchQuery} + + {/if} +
+ {/if} + + +
+ {#if filteredOptions.length === 0} +
Keine Ergebnisse
+ {:else} + {#each [...groupedOptions] as [groupName, groupOptions], groupIndex} + {#if groupName} +
{groupName}
+ {/if} + {#each groupOptions as option, optionIndex} + {@const flatIndex = selectableOptions.indexOf(option)} + + {/each} + {/each} + {/if} +
+ + + {#if multiSelect && Array.isArray(value) && value.length > 0} + + {/if} +
+ {/if} +
+ + diff --git a/packages/shared-ui/src/molecules/FilterDropdown.types.ts b/packages/shared-ui/src/molecules/FilterDropdown.types.ts new file mode 100644 index 000000000..39e45266c --- /dev/null +++ b/packages/shared-ui/src/molecules/FilterDropdown.types.ts @@ -0,0 +1,8 @@ +export interface FilterDropdownOption { + value: string; + label: string; + icon?: string; + disabled?: boolean; + divider?: boolean; + group?: string; +} diff --git a/packages/shared-ui/src/molecules/index.ts b/packages/shared-ui/src/molecules/index.ts index d9ef0b976..25d193845 100644 --- a/packages/shared-ui/src/molecules/index.ts +++ b/packages/shared-ui/src/molecules/index.ts @@ -3,7 +3,9 @@ export { default as Input } from './Input.svelte'; export { default as Select } from './Select.svelte'; export { default as Textarea } from './Textarea.svelte'; export { default as Checkbox } from './Checkbox.svelte'; +export { default as FilterDropdown } from './FilterDropdown.svelte'; export type { SelectOption } from './Select.types'; +export type { FilterDropdownOption } from './FilterDropdown.types'; // Stats components export { GlassCard, StatRow } from './stats';