Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docs): Fix Check for Object #1578

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading