Skip to content

Commit

Permalink
fix(me/sources): preferences stored on route level not merged (#3495)
Browse files Browse the repository at this point in the history
The preferences stored on a route level did not get merged after
splitting up sources and storage of `me` in #3408 . Using `merge` only
allows to merge two objects. To merge more than two objects we have to
use `merge.all`
([ref](https://www.npmjs.com/package/deepmerge#mergeallarrayofobjects-options)).
TypeScript would have catched that if we would have added another
object, because of too many parameters. Unfortunately the options object
is not strongly typed enough to catch `object` as `deepmerge.Options`.

Signed-off-by: schogges <[email protected]>
  • Loading branch information
schogges authored Jan 31, 2025
1 parent 779c4fc commit 06c7382
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/kuma-gui/src/app/me/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ export const sources = ({ get, set }: Storage) => {
get('/'),
get(params.route),
])
return merge(
{
params: {
size: 50,
format: 'structured',

return merge.all(
[
{
params: {
size: 50,
format: 'structured',
},
},
},
app,
route,
app,
route,
],
)
},
'/me/:route/:data': async (params) => {
Expand Down

0 comments on commit 06c7382

Please sign in to comment.