Skip to content

Commit

Permalink
fix(ie 11): add "manual" polyfill for array.flat (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
czosel authored May 11, 2019
1 parent c35872c commit fde3a0f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion addon/components/cf-field/input/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ import saveDocumentTableAnswerMutation from "ember-caluma/gql/mutations/save-doc
import { inject as service } from "@ember/service";
import { ComponentQueryManager } from "ember-apollo-client";

/**
* @babel/polyfill@^7.4.0 is supposed to include "flat", but that doesn't work of us -
* presumably because transitive dependencies still include babel 6 and the
* corresponding babel-polyfill package. So we include this "manual" polyfill for now.
*
* https://github.com/babel/babel/issues/9749
*/
function flat(arrays) {
return [].concat.apply([], arrays);
}

export default Component.extend(ComponentQueryManager, {
layout,

Expand Down Expand Up @@ -60,7 +71,7 @@ export default Component.extend(ComponentQueryManager, {
try {
const newDocument = this.get("documentToEdit");
yield all(newDocument.fields.map(f => f.validate.perform()));
if (newDocument.fields.map(f => f.errors).flat().length) {
if (flat(newDocument.fields.map(f => f.errors)).length) {
return;
}

Expand Down

0 comments on commit fde3a0f

Please sign in to comment.