Skip to content

Commit

Permalink
fix(docs): fixed check for object (#1578)
Browse files Browse the repository at this point in the history
  • Loading branch information
aednikanov authored Sep 26, 2024
1 parent 7d998fe commit 787cbb2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"jsonwebtoken": "^9.0.2",
"launchdarkly-js-client-sdk": "^3.3.0",
"lodash.debounce": "^4.0.8",
"lodash.isobject": "^3.0.2",
"lodash.isplainobject": "^4.0.6",
"node-polyfill-webpack-plugin": "^2.0.1",
"prettier": "^3.3.3",
"prism-react-renderer": "^2.1.0",
Expand Down
8 changes: 4 additions & 4 deletions src/components/ParserOpenRPC/InteractiveBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { Tooltip } from "@site/src/components/Tooltip";
import { useColorMode } from "@docusaurus/theme-common";
import { ParserOpenRPCContext } from "@site/src/components/ParserOpenRPC";
import { MetamaskProviderContext } from "@site/src/theme/Root";
import * as isObject from "lodash.isobject";
import * as isPlainObject from "lodash.isplainobject";
import { RemoveButton } from "@site/src/components/ParserOpenRPC/InteractiveBox/buttonTemplates/RemoveButton";
import { AddButton } from "@site/src/components/ParserOpenRPC/InteractiveBox/buttonTemplates/AddButton";

Expand Down Expand Up @@ -124,14 +124,14 @@ export default function InteractiveBox({
if (name === "Address" || name === "From") {
return [checkName(name), metaMaskAccount];
}
if (isObject(value)) {
if (isPlainObject(value)) {
return [checkName(name), getObjectWithAddress(value)];
}
}
if (isObject(value)) {
if (isPlainObject(value)) {
return [
checkName(name),
Object.fromEntries(Object.entries(value).map(([key, val]) => [key, isObject(val) && val?.description ? val.value : val]))
Object.fromEntries(Object.entries(value).map(([key, val]) => [key, isPlainObject(val) && val?.description ? val.value : val]))
];
}
return [checkName(name), value];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useContext, useEffect } from "react";
import { ADDITIONAL_PROPERTY_FLAG } from '@rjsf/utils';
import { BaseInputTemplate } from "@site/src/components/ParserOpenRPC/InteractiveBox/templates/BaseInputTemplate";
import { ParserOpenRPCContext } from "@site/src/components/ParserOpenRPC";
import * as isObject from "lodash.isobject"
import * as isPlainObject from "lodash.isplainobject"

export const WrapIfAdditionalTemplate = (props) => {
const {
Expand All @@ -26,7 +26,7 @@ export const WrapIfAdditionalTemplate = (props) => {
const { drawerLabel, isComplexTypeView, setIsComplexTypeView, setDrawerLabel } = useContext(ParserOpenRPCContext);
const { currentSchemaId, setCurrentSchemaId } = formContext;
const onRemoveButtonClick = () => {
if (isObject(formData) && Object.keys(formData).length === 0) {
if (isPlainObject(formData) && Object.keys(formData).length === 0) {
setIsComplexTypeView(false);
setDrawerLabel(null);
}
Expand Down
9 changes: 1 addition & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12988,13 +12988,6 @@ __metadata:
languageName: node
linkType: hard

"lodash.isobject@npm:^3.0.2":
version: 3.0.2
resolution: "lodash.isobject@npm:3.0.2"
checksum: 6c1667cbc4494d0a13a3617a4b23278d6d02dac520311f2bbb43f16f2cf71d2e6eb9dec8057315b77459df4890c756a256a087d3f4baa44a79ab5d6c968b060e
languageName: node
linkType: hard

"lodash.isplainobject@npm:^4.0.6":
version: 4.0.6
resolution: "lodash.isplainobject@npm:4.0.6"
Expand Down Expand Up @@ -13896,7 +13889,7 @@ __metadata:
jsonwebtoken: ^9.0.2
launchdarkly-js-client-sdk: ^3.3.0
lodash.debounce: ^4.0.8
lodash.isobject: ^3.0.2
lodash.isplainobject: ^4.0.6
node-polyfill-webpack-plugin: ^2.0.1
prettier: ^3.3.3
prism-react-renderer: ^2.1.0
Expand Down

0 comments on commit 787cbb2

Please sign in to comment.