Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-jsonschema-form

Package Overview
Dependencies
Maintainers
5
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-jsonschema-form - npm Package Compare versions

Comparing version 0.33.1 to 0.33.2

2

lib/components/fields/ArrayField.js

@@ -373,3 +373,3 @@ "use strict";

"div",
{ key: index },
{ key: index, className: "array-item" },
_react2.default.createElement(

@@ -376,0 +376,0 @@ "div",

@@ -13,2 +13,6 @@ "use strict";

var _deeper = require("deeper");
var _deeper2 = _interopRequireDefault(_deeper);
var _utils = require("../../utils");

@@ -26,2 +30,16 @@

function objectKeysHaveChanged(formData, state) {
// for performance, first check for lengths
var newKeys = Object.keys(formData);
var oldKeys = Object.keys(state);
if (newKeys.length < oldKeys.length) {
return true;
}
// deep check on sorted keys
if (!(0, _deeper2.default)(newKeys.sort(), oldKeys.sort())) {
return true;
}
return false;
}
var ObjectField = function (_Component) {

@@ -48,3 +66,13 @@ _inherits(ObjectField, _Component);

value: function componentWillReceiveProps(nextProps) {
this.setState(this.getStateFromProps(nextProps));
var state = this.getStateFromProps(nextProps);
var formData = nextProps.formData;
if (formData && objectKeysHaveChanged(formData, this.state)) {
// We *need* to replace state entirely here has we have received formData
// holding different keys (so with some removed).
this.state = state;
this.forceUpdate();
} else {
this.setState(state);
}
}

@@ -51,0 +79,0 @@ }, {

@@ -128,3 +128,12 @@ "use strict";

var idSchema = (0, _utils.toIdSchema)(schema, uiSchema["ui:rootFieldId"], definitions);
return { status: "initial", formData: formData, edit: edit, errors: errors, errorSchema: errorSchema, idSchema: idSchema };
return {
status: "initial",
schema: schema,
uiSchema: uiSchema,
idSchema: idSchema,
formData: formData,
edit: edit,
errors: errors,
errorSchema: errorSchema
};
}

@@ -180,4 +189,2 @@ }, {

var children = _props.children;
var schema = _props.schema;
var uiSchema = _props.uiSchema;
var safeRenderCompletion = _props.safeRenderCompletion;

@@ -194,2 +201,4 @@ var id = _props.id;

var _state2 = this.state;
var schema = _state2.schema;
var uiSchema = _state2.uiSchema;
var formData = _state2.formData;

@@ -196,0 +205,0 @@ var errorSchema = _state2.errorSchema;

{
"name": "react-jsonschema-form",
"version": "0.33.1",
"version": "0.33.2",
"description": "A simple React component capable of building HTML forms out of a JSON schema.",

@@ -29,3 +29,3 @@ "scripts": {

"peerDependencies": {
"react": "^0.14.0 || ^15.0.0"
"react": "^15.0.0"
},

@@ -32,0 +32,0 @@ "dependencies": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc