reitit icon indicating copy to clipboard operation
reitit copied to clipboard

Route data maps merge differently in 0.7.0, breaking compatibility

Open svdm opened this issue 9 months ago • 0 comments

In 0.6.0, nested map data is merged in a way that matches meta-merge, supporting ^:replace:

user> (meta-merge {:roles {:foo false :bar true}} {:roles ^:replace {:foo true}})
{:roles {:foo true}}

user> (r/routes (r/router
                 ["/context" {:roles {:foo false :bar true}}
                  ["/leaf" {:roles ^:replace {:foo true}}]]))
[["/context/leaf" {:roles {:foo true}}]]

In 0.7.0, this is no longer the case, ^:replace is not respected:

user> (r/routes (r/router
                 ["/context" {:roles {:foo false :bar true}}
                  ["/leaf" {:roles ^:replace {:foo true}}]]))
[["/context/leaf" {:roles {:foo true, :bar true}}]]

This is not documented in the changelog so I assume it's not intentional.

svdm avatar May 01 '24 14:05 svdm