Skip to content

Commit

Permalink
fix(common): debug was memoizing too much
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed Jul 17, 2019
1 parent 7301ed5 commit b336561
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions packages/common/src/debug.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import debug from 'debug';

import {NAMESPACE} from './constants.js';
import {SHORT_NAMESPACE} from './constants.js';
import {tap} from './observable.js';
import {_} from './util.js';

const NAMESPACE_SEPARATOR = ':';
const APP_NAMESPACE = `${NAMESPACE}*`;
const APP_NAMESPACE = `${SHORT_NAMESPACE}*`;

const joinDebugNamespace = _.join(NAMESPACE_SEPARATOR);

const getDebugNamespace = _.memoize((...args) =>
joinDebugNamespace([NAMESPACE, ...args])
);
const getDebugNamespace = (...args) =>
joinDebugNamespace([SHORT_NAMESPACE, ...args]);

export const createDebugger = _.memoize(
_.pipe(
getDebugNamespace,
debug
)
export const createDebugger = _.pipe(
getDebugNamespace,
debug
);

export const enableDebugger = () => {
Expand Down

0 comments on commit b336561

Please sign in to comment.