From c9514cefc638ae9ff876659123dbf85af37cd471 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 8 Dec 2020 15:44:35 +0000 Subject: [PATCH] Sort routes to ensure the client router always matches correctly --- packages/client/src/store/routes.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/client/src/store/routes.js b/packages/client/src/store/routes.js index c69bb83ef0..88ca90df73 100644 --- a/packages/client/src/store/routes.js +++ b/packages/client/src/store/routes.js @@ -21,6 +21,12 @@ const createRouteStore = () => { }) }) }) + + // Sort route by paths so that the router matches correctly + routes.sort((a, b) => { + return a.path > b.path ? -1 : 1 + }) + store.update(state => { state.routes = routes return state