-
Matiss Janis Aboltins authored
Closes #1415 Fix number formatter not listening to state changes. This is not a fully comprehensive solution. We will need to run a migration campaign to port over from direct usage of `format` util to `useFormat`, but this is a first step that solves the most glaring issue.
Matiss Janis Aboltins authoredCloses #1415 Fix number formatter not listening to state changes. This is not a fully comprehensive solution. We will need to run a migration campaign to port over from direct usage of `format` util to `useFormat`, but this is a first step that solves the most glaring issue.
selectors.ts 511 B
import { createSelector } from 'reselect';
import { getNumberFormat } from '../shared/util';
import type { State } from './state-types';
const getState = (state: State) => state;
const getPrefsState = createSelector(getState, state => state.prefs);
const getLocalPrefsState = createSelector(getPrefsState, prefs => prefs.local);
export const selectNumberFormat = createSelector(getLocalPrefsState, prefs =>
getNumberFormat({
format: prefs.numberFormat,
hideFraction: prefs.hideFraction,
}),
);