Skip to content

Commit

Permalink
PB-259: Improved logging of the router store subscriber
Browse files Browse the repository at this point in the history
Do not log for non watched mutation because this is missleading in the logs.

There is already anther global mutation watcher that logs all mutations.
  • Loading branch information
ltshb committed Feb 28, 2024
1 parent 4af0246 commit 53c43f1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/router/storeSync/storeSync.routerPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ let routeChangeIsTriggeredByThisModule = false
* @param {Router} router
*/
function storeMutationWatcher(store, mutation, router) {
log.debug(
'[store sync router] store mutation',
mutation,
'Current route',
router.currentRoute.value
)

// Ignore mutation that has been triggered by the router.beforeEach below.
if (mutationNotTriggeredByModule(mutation) && mutationWatched(mutation)) {
log.debug(
'[store sync router] store mutation',
mutation,
'Current route',
router.currentRoute.value
)

// if the value in the store differs from the one in the URL
if (isRoutePushNeeded(store, router.currentRoute.value)) {
const query = {}
Expand All @@ -73,7 +73,7 @@ function storeMutationWatcher(store, mutation, router) {
query,
})
.catch((error) => {
log.info('Error while routing to', query, error)
log.error('Error while routing to', query, error)
})
.finally(() => {
routeChangeIsTriggeredByThisModule = false
Expand Down

0 comments on commit 53c43f1

Please sign in to comment.