@projectcaluma/ember-form 11.1.3 → 11.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,7 @@
7
7
  }}"
8
8
  {{did-insert this.registerComponent}}
9
9
  {{will-destroy this.unregisterComponent}}
10
+ {{in-viewport onEnter=this.refreshDynamicOptions}}
10
11
  >
11
12
  {{#if this.labelVisible}}
12
13
  <CfField::Label @field={{@field}} />
@@ -91,4 +91,11 @@ export default class CfFieldComponent extends Component {
91
91
 
92
92
  return yield this.args.field.save.unlinked().perform();
93
93
  }
94
+
95
+ @action
96
+ refreshDynamicOptions() {
97
+ if (this.args.field.question.isDynamic) {
98
+ this.args.field.question.dynamicOptions.retry();
99
+ }
100
+ }
94
101
  }
@@ -1,8 +1,7 @@
1
1
  import { assert } from "@ember/debug";
2
2
  import { camelize } from "@ember/string";
3
3
  import { queryManager } from "ember-apollo-client";
4
- import { dropTask } from "ember-concurrency";
5
- import { trackedTask } from "ember-resources/util/ember-concurrency";
4
+ import { trackedFunction } from "ember-resources/util/function";
6
5
  import { cached } from "tracked-toolbox";
7
6
 
8
7
  import getDynamicOptions from "@projectcaluma/ember-form/gql/queries/dynamic-options.graphql";
@@ -51,18 +50,10 @@ export default class Question extends Base {
51
50
  return this.raw.slug;
52
51
  }
53
52
 
54
- /**
55
- * Load all dynamic options for this question
56
- *
57
- * @method loadDynamicOptions.perform
58
- * @return {Object[]} The dynamic options
59
- * @public
60
- */
61
- @dropTask
62
- *loadDynamicOptions() {
53
+ dynamicOptions = trackedFunction(this, async () => {
63
54
  if (!this.isDynamic) return;
64
55
 
65
- const [question] = yield this.apollo.query(
56
+ const [question] = await this.apollo.query(
66
57
  {
67
58
  query: getDynamicOptions,
68
59
  fetchPolicy: "network-only",
@@ -80,9 +71,7 @@ export default class Question extends Base {
80
71
  question.node.dynamicChoiceOptions ??
81
72
  question.node.dynamicMultipleChoiceOptions
82
73
  );
83
- }
84
-
85
- dynamicOptions = trackedTask(this, this.loadDynamicOptions, () => []);
74
+ });
86
75
 
87
76
  get dynamicChoiceOptions() {
88
77
  return this.dynamicOptions.value ?? [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-form",
3
- "version": "11.1.3",
3
+ "version": "11.1.5",
4
4
  "description": "Ember addon for rendering Caluma forms.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -18,7 +18,7 @@
18
18
  "@embroider/util": "^1.10.0",
19
19
  "@glimmer/component": "^1.1.2",
20
20
  "@glimmer/tracking": "^1.1.2",
21
- "@projectcaluma/ember-core": "^11.1.3",
21
+ "@projectcaluma/ember-core": "^11.1.5",
22
22
  "ember-apollo-client": "~4.0.2",
23
23
  "ember-auto-import": "^2.6.1",
24
24
  "ember-autoresize-modifier": "^0.7.0",
@@ -44,11 +44,11 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@ember/optional-features": "2.0.0",
47
- "@ember/test-helpers": "2.7.0",
47
+ "@ember/test-helpers": "2.9.3",
48
48
  "@embroider/test-setup": "2.1.1",
49
49
  "@faker-js/faker": "7.6.0",
50
- "@projectcaluma/ember-testing": "11.1.3",
51
- "@projectcaluma/ember-workflow": "^11.1.3",
50
+ "@projectcaluma/ember-testing": "11.1.5",
51
+ "@projectcaluma/ember-workflow": "^11.1.5",
52
52
  "broccoli-asset-rev": "3.0.0",
53
53
  "ember-cli": "4.11.0",
54
54
  "ember-cli-code-coverage": "2.0.0",
@@ -58,20 +58,21 @@
58
58
  "ember-cli-sri": "2.1.1",
59
59
  "ember-cli-terser": "4.0.2",
60
60
  "ember-load-initializers": "2.1.2",
61
- "ember-qunit": "6.1.1",
61
+ "ember-qunit": "6.2.0",
62
62
  "ember-resolver": "10.0.0",
63
- "ember-source": "4.11.0",
63
+ "ember-source": "4.12.0",
64
64
  "ember-source-channel-url": "3.0.0",
65
65
  "ember-try": "2.0.0",
66
66
  "loader.js": "4.7.0",
67
67
  "miragejs": "0.1.47",
68
68
  "qunit": "2.19.4",
69
69
  "qunit-dom": "2.0.0",
70
+ "uikit": "3.16.13",
70
71
  "uuid": "9.0.0",
71
72
  "webpack": "5.77.0"
72
73
  },
73
74
  "peerDependencies": {
74
- "@projectcaluma/ember-workflow": "^11.1.3",
75
+ "@projectcaluma/ember-workflow": "^11.1.5",
75
76
  "ember-source": "^3.28.0 || ^4.0.0"
76
77
  },
77
78
  "peerDependenciesMeta": {