solidjs / solid-router

A universal router for Solid inspired by Ember and React Router
MIT License
1.1k stars 137 forks source link

`useCurrentMatches` is not reactive #425

Closed mattersj closed 1 month ago

mattersj commented 1 month ago

Describe the bug

Object returned from useCurrentMatches is not reactive at all, wrapping it in createMemo (as shown in the router docs) will have no effect. It simply won't get triggered when path/params/info changes. The only way to get this working is to call useCurrentMatches again within some effect which is, obviously, not right.

Your Example Website or App

https://stackblitz.com/edit/solid-router-ckudid?file=src/index.tsx

Steps to Reproduce the Bug or Issue

  1. Open the repro and your console
  2. Start clicking on the links and check out the output
  3. info will never get updated

Expected behavior

useCurrentMatches should return a proxy that updates whenever a list of matched routes changes.

Screenshots or Videos

No response

Platform

Additional context

No response