fix: replace lodash set with immutable version (#940)

This commit is contained in:
Daniel Lautzenheiser
2023-10-15 10:23:17 -04:00
committed by GitHub
parent 7ec1548d03
commit ff48959331
8 changed files with 17 additions and 6 deletions

View File

@ -112,6 +112,7 @@
"gray-matter": "4.0.3",
"history": "5.3.0",
"immer": "10.0.1",
"immutable": "4.3.4",
"ini": "4.1.0",
"is-hotkey": "0.2.0",
"js-base64": "3.7.5",

View File

@ -3,7 +3,6 @@ import attempt from 'lodash/attempt';
import flatten from 'lodash/flatten';
import get from 'lodash/get';
import isError from 'lodash/isError';
import set from 'lodash/set';
import uniq from 'lodash/uniq';
import { dirname } from 'path';
@ -49,6 +48,7 @@ import { DRAFT_MEDIA_FILES, selectMediaFilePublicPath } from './lib/util/media.u
import { selectCustomPath, slugFromCustomPath } from './lib/util/nested.util';
import { isNullish } from './lib/util/null.util';
import { fileSearch, sortByScore } from './lib/util/search.util';
import set from './lib/util/set.util';
import { dateParsers, expandPath, extractTemplateVars } from './lib/widgets/stringTemplate';
import createEntry from './valueObjects/createEntry';

View File

@ -1,10 +1,10 @@
import get from 'lodash/get';
import set from 'lodash/set';
import { COMMIT_AUTHOR, COMMIT_DATE } from '../constants/commitProps';
import { sanitizeSlug } from './urlHelper';
import { selectIdentifier, selectInferredField } from './util/collection.util';
import { selectField } from './util/field.util';
import set from './util/set.util';
import { isEmpty } from './util/string.util';
import {
addFileTemplateFields,

View File

@ -1,9 +1,9 @@
import escapeRegExp from 'lodash/escapeRegExp';
import get from 'lodash/get';
import groupBy from 'lodash/groupBy';
import set from 'lodash/set';
import { fileForEntry, selectEntrySlug } from './util/collection.util';
import set from './util/set.util';
import type {
BaseField,

View File

@ -0,0 +1,5 @@
import { setIn } from 'immutable';
export default function set<T>(object: T, path: string, value: unknown): T {
return setIn(object, path.split('.'), value);
}

View File

@ -1,5 +1,4 @@
import once from 'lodash/once';
import set from 'lodash/set';
import sortBy from 'lodash/sortBy';
import {
@ -24,6 +23,7 @@ import {
SORT_ENTRIES_SUCCESS,
} from '../constants';
import { VIEW_STYLES, VIEW_STYLE_TABLE } from '../constants/views';
import set from '../lib/util/set.util';
import type { EntriesAction } from '../actions/entries';
import type { SearchAction } from '../actions/search';

View File

@ -1,6 +1,5 @@
import isEqual from 'lodash/isEqual';
import set from 'lodash/set';
import cloneDeep from 'lodash/cloneDeep';
import isEqual from 'lodash/isEqual';
import { v4 as uuid } from 'uuid';
import {
@ -25,6 +24,7 @@ import {
import { duplicateI18nFields, getDataPath } from '../lib/i18n';
import { fileForEntry } from '../lib/util/collection.util';
import { applyDefaultsToDraftData } from '../lib/util/entry.util';
import set from '../lib/util/set.util';
import type { EntriesAction } from '../actions/entries';
import type { Entry, FieldsErrors } from '../interface';