Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Refactor all of the Routers #696

Open
jurajpiar opened this issue Feb 3, 2021 · 0 comments
Open

Refactor all of the Routers #696

jurajpiar opened this issue Feb 3, 2021 · 0 comments

Comments

@jurajpiar
Copy link
Member

jurajpiar commented Feb 3, 2021

All the routers currently run logging useEffect even in production environment.
Refactor so that it only runs when REACT_APP_LOG_LEVEL=debug to avoid unnecessary re-renderring.
For example:

useEffect(() => {
    // TODO: wrap this code block to be excecuted only on debugging
    const unlisten = history.listen((location, action) => {
      logger.debug('TriggersRoutes -> location', location)
      logger.debug('TriggersRoutes -> action', action)
    })
    return (): void => {
      unlisten()
    }
  }, [history])
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant