Skip to content

Conversation

@chrisgreg
Copy link
Owner

Fix nested route support for InboxLive

Problem

When mounting the FYI routes in a nested scope (e.g., /admin/fyi instead of /fyi), the
InboxLive URLs were hardcoded to /fyi/*, causing 404 errors when clicking on event details.

Solution

  • Dynamically extract the route prefix from the current URI in handle_params/3
  • Updated build_url/3 and event_url/4 to use the extracted route prefix instead of
    hardcoded paths
  • Made event_url/4 handle both socket and assigns parameters for template compatibility

Testing

  • Added comprehensive test suite (test/fyi/web/inbox_live_test.exs) with 13 tests covering:
    • Route prefix extraction from various URI formats
    • URL generation for root-level and nested scopes
    • Event detail and index URLs with query parameters
  • All 65 tests pass

Impact

Users can now mount FYI routes at any scope level:

  • /fyi (default)
  • /admin/fyi
  • /admin/dashboard/fyi
  • Any other nested scope

@chrisgreg chrisgreg force-pushed the fix-nested-route-support-for-inboxlive branch from fe11576 to 15fc65e Compare December 28, 2025 11:53
@chrisgreg chrisgreg merged commit 28db665 into main Dec 28, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants