Skip to content

Commit 6eab96c

Browse files
committed
More fixes for #750 under different scenario
1 parent 01ba883 commit 6eab96c

File tree

4 files changed

+65
-43
lines changed

4 files changed

+65
-43
lines changed

CHANGELOG

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1-
v1.0.0-alpha.3
1+
v1.0.0-alpha.4 (unreleased)
22
--------------
3-
This is the third (of many) alpha and is **NOT ready for production** yet.
3+
This is the fourth (of many) alpha and is **NOT ready for production** yet.
4+
5+
This alpha fixes a few bugs like array item deletion not working.
6+
7+
## Known issues
8+
- In Angular 1.5+ some odd behaviours can occur if refreshing a form with a flash of content experienced
9+
The digest cycle is getting stuck under some unknown conditions which is most likely related
410

11+
## Changes
12+
13+
### Fixed
14+
- #750 Removing an invalid array item doesn't work properly
15+
16+
v1.0.0-alpha.3
17+
--------------
518
This alpha fixes a few bugs like the annoying "Invalid type, expected array" error when an array content is invalid.
619

720
## Known issues
@@ -13,7 +26,7 @@ This alpha fixes a few bugs like the annoying "Invalid type, expected array" err
1326
### Fixed
1427
- Arrays update validity more consistently, removed Angular version specific code
1528
- Add-ons will now correctly display by the added type being passed to the core correctly
16-
- #750 Unstoppable "Invalid type, expected array" when form initialised with incorrect array content.
29+
- #625 Unstoppable "Invalid type, expected array" when form initialised with incorrect array content.
1730
- #633 #602 custom validator errors.
1831
- #558 Add check for schema property to prevent form generation failures when a checkbox is explicitly defined by a developer (and therefore does not have a schema property) by @vinceis1337 in #663
1932

dist/angular-schema-form.js

+42-36
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* angular-schema-form
33
* @version 1.0.0-alpha.4
4-
* @date Mon, 03 Apr 2017 12:57:49 GMT
4+
* @date Mon, 03 Apr 2017 13:29:07 GMT
55
* @link https://github.com/json-schema-form/angular-schema-form
66
* @license MIT
77
* Copyright (c) 2014-2017 JSON Schema Form
@@ -71,7 +71,7 @@
7171
/******/ __webpack_require__.p = "";
7272
/******/
7373
/******/ // Load entry module and return exports
74-
/******/ return __webpack_require__(__webpack_require__.s = 19);
74+
/******/ return __webpack_require__(__webpack_require__.s = 21);
7575
/******/ })
7676
/************************************************************************/
7777
/******/ ([
@@ -2729,7 +2729,7 @@ module.exports = __webpack_require__(4);
27292729
/***/ })
27302730
/******/ ]);
27312731
//# sourceMappingURL=json-schema-form-core.js.map
2732-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(18).setImmediate))
2732+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(19).setImmediate))
27332733

27342734
/***/ }),
27352735
/* 2 */
@@ -2759,7 +2759,8 @@ module.exports = g;
27592759

27602760

27612761
/***/ }),
2762-
/* 3 */
2762+
/* 3 */,
2763+
/* 4 */
27632764
/***/ (function(module, __webpack_exports__, __webpack_require__) {
27642765

27652766
"use strict";
@@ -2768,18 +2769,18 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
27682769
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_json_schema_form_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_json_schema_form_core__);
27692770
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_angular__ = __webpack_require__(0);
27702771
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_angular___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_angular__);
2771-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_sf_builder_provider__ = __webpack_require__(13);
2772-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_schema_form_decorators_provider__ = __webpack_require__(11);
2773-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_schema_form_provider__ = __webpack_require__(12);
2774-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_sf_error_message_provider__ = __webpack_require__(14);
2775-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_sf_path_provider__ = __webpack_require__(15);
2776-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_sf_changed_directive__ = __webpack_require__(6);
2777-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_sf_field_directive__ = __webpack_require__(7);
2778-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_sf_message_directive__ = __webpack_require__(9);
2779-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_sf_array_directive__ = __webpack_require__(5);
2780-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_sf_key_directive__ = __webpack_require__(8);
2781-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_sf_schema_directive__ = __webpack_require__(10);
2782-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13_schema_validate_directive__ = __webpack_require__(4);
2772+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_sf_builder_provider__ = __webpack_require__(14);
2773+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_schema_form_decorators_provider__ = __webpack_require__(12);
2774+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_schema_form_provider__ = __webpack_require__(13);
2775+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_sf_error_message_provider__ = __webpack_require__(15);
2776+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_sf_path_provider__ = __webpack_require__(16);
2777+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_sf_changed_directive__ = __webpack_require__(7);
2778+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_sf_field_directive__ = __webpack_require__(8);
2779+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_sf_message_directive__ = __webpack_require__(10);
2780+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_sf_array_directive__ = __webpack_require__(6);
2781+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_sf_key_directive__ = __webpack_require__(9);
2782+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_sf_schema_directive__ = __webpack_require__(11);
2783+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13_schema_validate_directive__ = __webpack_require__(5);
27832784

27842785

27852786

@@ -2833,7 +2834,7 @@ __WEBPACK_IMPORTED_MODULE_1_angular___default.a.module('schemaForm', deps)
28332834
.directive('sfChanged', __WEBPACK_IMPORTED_MODULE_7_sf_changed_directive__["a" /* default */]).directive('sfField', ['$parse', '$compile', '$http', '$templateCache', '$interpolate', '$q', 'sfErrorMessage', 'sfPath', 'sfSelect', __WEBPACK_IMPORTED_MODULE_8_sf_field_directive__["a" /* default */]]).directive('sfMessage', ['$injector', 'sfErrorMessage', __WEBPACK_IMPORTED_MODULE_9_sf_message_directive__["a" /* default */]]).directive('sfNewArray', ['sfSelect', 'sfPath', 'schemaForm', __WEBPACK_IMPORTED_MODULE_10_sf_array_directive__["a" /* default */]]).directive('sfSchema', ['$compile', '$http', '$templateCache', '$q', 'schemaForm', 'schemaFormDecorators', 'sfSelect', 'sfPath', 'sfBuilder', __WEBPACK_IMPORTED_MODULE_12_sf_schema_directive__["a" /* default */]]).directive('schemaValidate', ['sfValidator', '$parse', 'sfSelect', __WEBPACK_IMPORTED_MODULE_13_schema_validate_directive__["a" /* default */]]).directive('sfKeyController', ['schemaForm', 'sfPath', __WEBPACK_IMPORTED_MODULE_11_sf_key_directive__["a" /* default */]]);
28342835

28352836
/***/ }),
2836-
/* 4 */
2837+
/* 5 */
28372838
/***/ (function(module, __webpack_exports__, __webpack_require__) {
28382839

28392840
"use strict";
@@ -3023,7 +3024,7 @@ __WEBPACK_IMPORTED_MODULE_1_angular___default.a.module('schemaForm', deps)
30233024
};
30243025

30253026
/***/ }),
3026-
/* 5 */
3027+
/* 6 */
30273028
/***/ (function(module, __webpack_exports__, __webpack_require__) {
30283029

30293030
"use strict";
@@ -3267,7 +3268,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
32673268
};
32683269

32693270
/***/ }),
3270-
/* 6 */
3271+
/* 7 */
32713272
/***/ (function(module, __webpack_exports__, __webpack_require__) {
32723273

32733274
"use strict";
@@ -3313,7 +3314,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
33133314
};
33143315

33153316
/***/ }),
3316-
/* 7 */
3317+
/* 8 */
33173318
/***/ (function(module, __webpack_exports__, __webpack_require__) {
33183319

33193320
"use strict";
@@ -3601,7 +3602,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
36013602
var arrayIndex = typeof scope.arrayIndex == 'number' ? scope.arrayIndex + 1 : 0;
36023603

36033604
// If the entire schema form is destroyed we don't touch the model
3604-
if (!scope.externalDestructionInProgress && (!scope.model.$$hashKey || scope.model.$$hashKey === scope.destroyed)) {
3605+
if (!scope.externalDestructionInProgress) {
36053606
var destroyStrategy = form.destroyStrategy || scope.options && scope.options.destroyStrategy || 'remove';
36063607
// No key no model, and we might have strategy 'retain'
36073608
if (key && destroyStrategy !== 'retain') {
@@ -3612,6 +3613,10 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
36123613
obj = sfSelect(key.slice(0, key.length - 1), obj);
36133614
}
36143615

3616+
if (obj && obj.$$hashKey && obj.$$hashKey !== scope.destroyed) {
3617+
return;
3618+
}
3619+
36153620
// We can get undefined here if the form hasn't been filled out entirely
36163621
if (obj === undefined) {
36173622
return;
@@ -3643,7 +3648,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
36433648
};
36443649

36453650
/***/ }),
3646-
/* 8 */
3651+
/* 9 */
36473652
/***/ (function(module, __webpack_exports__, __webpack_require__) {
36483653

36493654
"use strict";
@@ -3682,7 +3687,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
36823687
};;
36833688

36843689
/***/ }),
3685-
/* 9 */
3690+
/* 10 */
36863691
/***/ (function(module, __webpack_exports__, __webpack_require__) {
36873692

36883693
"use strict";
@@ -3786,7 +3791,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
37863791
};
37873792

37883793
/***/ }),
3789-
/* 10 */
3794+
/* 11 */
37903795
/***/ (function(module, __webpack_exports__, __webpack_require__) {
37913796

37923797
"use strict";
@@ -4016,7 +4021,7 @@ FIXME: real documentation
40164021
};
40174022

40184023
/***/ }),
4019-
/* 11 */
4024+
/* 12 */
40204025
/***/ (function(module, __webpack_exports__, __webpack_require__) {
40214026

40224027
"use strict";
@@ -4559,7 +4564,7 @@ FIXME: real documentation
45594564
};;
45604565

45614566
/***/ }),
4562-
/* 12 */
4567+
/* 13 */
45634568
/***/ (function(module, __webpack_exports__, __webpack_require__) {
45644569

45654570
"use strict";
@@ -4698,7 +4703,7 @@ FIXME: real documentation
46984703
};
46994704

47004705
/***/ }),
4701-
/* 13 */
4706+
/* 14 */
47024707
/***/ (function(module, __webpack_exports__, __webpack_require__) {
47034708

47044709
"use strict";
@@ -5026,7 +5031,7 @@ FIXME: real documentation
50265031
};
50275032

50285033
/***/ }),
5029-
/* 14 */
5034+
/* 15 */
50305035
/***/ (function(module, __webpack_exports__, __webpack_require__) {
50315036

50325037
"use strict";
@@ -5163,7 +5168,7 @@ FIXME: real documentation
51635168
};
51645169

51655170
/***/ }),
5166-
/* 15 */
5171+
/* 16 */
51675172
/***/ (function(module, __webpack_exports__, __webpack_require__) {
51685173

51695174
"use strict";
@@ -5203,7 +5208,7 @@ var sfPathProviderClass = function () {
52035208
/* harmony default export */ __webpack_exports__["a"] = sfPathProviderClass;
52045209

52055210
/***/ }),
5206-
/* 16 */
5211+
/* 17 */
52075212
/***/ (function(module, exports) {
52085213

52095214
// shim for using process in browser
@@ -5389,7 +5394,7 @@ process.umask = function() { return 0; };
53895394

53905395

53915396
/***/ }),
5392-
/* 17 */
5397+
/* 18 */
53935398
/***/ (function(module, exports, __webpack_require__) {
53945399

53955400
/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
@@ -5579,10 +5584,10 @@ process.umask = function() { return 0; };
55795584
attachTo.clearImmediate = clearImmediate;
55805585
}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
55815586

5582-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(16)))
5587+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(17)))
55835588

55845589
/***/ }),
5585-
/* 18 */
5590+
/* 19 */
55865591
/***/ (function(module, exports, __webpack_require__) {
55875592

55885593
var apply = Function.prototype.apply;
@@ -5635,17 +5640,18 @@ exports._unrefActive = exports.active = function(item) {
56355640
};
56365641

56375642
// setimmediate attaches itself to the global object
5638-
__webpack_require__(17);
5643+
__webpack_require__(18);
56395644
exports.setImmediate = setImmediate;
56405645
exports.clearImmediate = clearImmediate;
56415646

56425647

56435648
/***/ }),
5644-
/* 19 */
5649+
/* 20 */,
5650+
/* 21 */
56455651
/***/ (function(module, exports, __webpack_require__) {
56465652

56475653
__webpack_require__(1);
5648-
module.exports = __webpack_require__(3);
5654+
module.exports = __webpack_require__(4);
56495655

56505656

56515657
/***/ })

dist/angular-schema-form.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/directives/sf-field.directive.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,7 @@ sfPath, sfSelect) {
295295
let arrayIndex = (typeof scope.arrayIndex == 'number') ? scope.arrayIndex + 1: 0;
296296

297297
// If the entire schema form is destroyed we don't touch the model
298-
if (!scope.externalDestructionInProgress &&
299-
(!scope.model.$$hashKey || scope.model.$$hashKey === scope.destroyed)) {
298+
if (!scope.externalDestructionInProgress) {
300299
var destroyStrategy = form.destroyStrategy ||
301300
(scope.options && scope.options.destroyStrategy) || 'remove';
302301
// No key no model, and we might have strategy 'retain'
@@ -308,6 +307,10 @@ sfPath, sfSelect) {
308307
obj = sfSelect(key.slice(0, key.length - 1), obj);
309308
}
310309

310+
if(obj && obj.$$hashKey && obj.$$hashKey !== scope.destroyed) {
311+
return;
312+
}
313+
311314
// We can get undefined here if the form hasn't been filled out entirely
312315
if (obj === undefined) {
313316
return;

0 commit comments

Comments
 (0)