Skip to content

Commit 442c40e

Browse files
replace lodash.merge with smaller just.extend (#565)
1 parent da3e442 commit 442c40e

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

package-lock.json

Lines changed: 12 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/gasket-react-intl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@gasket/fetch": "^6.38.1",
5050
"@gasket/helper-intl": "^6.38.1",
5151
"hoist-non-react-statics": "^3.0.0",
52-
"lodash.merge": "^4.6.0",
52+
"just-extend": "^6.2.0",
5353
"prop-types": "^15.7.2"
5454
},
5555
"devDependencies": {

packages/gasket-react-intl/src/with-intl-provider.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useReducer } from 'react';
22
import hoistNonReactStatics from 'hoist-non-react-statics';
3-
import merge from 'lodash.merge';
3+
import extend from 'just-extend';
44
import { IntlProvider } from 'react-intl';
55
import { GasketIntlContext } from './context';
66
import { clientData, isBrowser } from './config';
@@ -17,7 +17,7 @@ export function init(localesProps) {
1717
if (isBrowser) {
1818
// merge any data set on window with what comes from SSR or static page props
1919
const { messages: dataMessages = {}, status: dataStatus = {} } = clientData;
20-
return merge({}, { messages: dataMessages, status: dataStatus }, { messages, status });
20+
return extend(true, {}, { messages: dataMessages, status: dataStatus }, { messages, status });
2121
}
2222

2323
return { messages, status };
@@ -89,7 +89,7 @@ export default function withIntlProvider() {
8989
// If we have incoming pageProps, we need to update state but have to by
9090
// mutation rather than issuing a dispatch to avoid re-renders and timing issues
9191
if (localesProps) {
92-
merge(state, localesProps);
92+
extend(true, state, localesProps);
9393
}
9494

9595
const locale = localesProps?.locale ||

0 commit comments

Comments
 (0)