feat(routing): Add routing infra to contact book manager#99
feat(routing): Add routing infra to contact book manager#99mohamedmansour merged 14 commits intomainfrom
Conversation
Handler: - RenderOptions with entry_id and request_path - Route matcher: iterative path matching (no regex) - Route handler: component inventory, f-template queries - Route fragment rendering with specificity-based matching - Perf: escape_html buffer reuse, route scan guard Bindings: - FFI: 6-param webui_handler_render, webui_get_route_templates - Node: render() with entry + requestPath - WASM: routing support in render and build_and_render - CLI serve: JSON partial responses for client navigation Updated DESIGN.md, integration examples, benchmarks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Navigation API interception for SPA transitions - Self-registering <webui-route> custom element via connectedCallback - Iterative path matching with :param, :param?, *splat (no regex) - Specificity-based route ranking - Opt-in lazy loading via loaders config with promise dedup - SSR-safe: preserves server-rendered DOM on initial navigation - Component inventory bloom filter for template dedup - webui:route:navigated CustomEvent after each navigation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…xample
- Route definitions in cb-app.html (<route> directive)
- Page components: dashboard, contacts, favorites, group
- Co-located child imports (each component imports its own deps)
- Lazy loading via Router.start({ loaders }) + esbuild --splitting
- Server API for contact CRUD operations
There was a problem hiding this comment.
routes made this app so complicated to understand, at least for me.
We should revisit this, once Fast issue gets fixed (specially there are lot of components ts code which I did not bother review it)
Can you also run the performance benchmark before merging code?
cargo bench -p webui --bench contact_book_bench
|
| totalContacts: contacts.length, | ||
| totalFavorites: favorites.length, | ||
| totalGroups: groups.length, | ||
| groups, |
| if (query) { | ||
| const q = query.toLowerCase(); | ||
| result = result.filter(c => | ||
| c.firstName.toLowerCase().indexOf(q) !== -1 || |
There was a problem hiding this comment.
not saying you have to change it but you have this computeinitials thing as a helper earlier and then you aren't using it here.
mohamedmansour
left a comment
There was a problem hiding this comment.
First pass
| phone: c.getAttribute('phone') || '', | ||
| company: c.getAttribute('company') || '', | ||
| group: c.getAttribute('group') || '', | ||
| favorite: c.getAttribute('favorite') === 'true', |
There was a problem hiding this comment.
Isn't this a boolean? I think I would expect c.hasAttribute('favorite')
Description:
Refactors the contact-book-manager example from a single-page monolith into a route-based architecture with lazy-loaded page components and a dedicated Express API server.
Changes
text-decoration