@projectcaluma/ember-form 14.15.0 → 14.15.2

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.
@@ -2,7 +2,9 @@ import { assert } from "@ember/debug";
2
2
  import { inject as service } from "@ember/service";
3
3
  import { camelize } from "@ember/string";
4
4
  import { queryManager } from "ember-apollo-client";
5
+ import { use } from "ember-resources";
5
6
  import { trackedFunction } from "reactiveweb/function";
7
+ import { keepLatest } from "reactiveweb/keep-latest";
6
8
  import { cached } from "tracked-toolbox";
7
9
 
8
10
  import getDynamicOptions from "@projectcaluma/ember-form/gql/queries/dynamic-options.graphql";
@@ -76,12 +78,19 @@ export default class Question extends Base {
76
78
  );
77
79
  });
78
80
 
81
+ // Keep the previously resolved options while the dynamic options are being
82
+ // refetched to avoid flickering of the options in the UI
83
+ @use latestDynamicOptions = keepLatest({
84
+ when: () => this.dynamicOptions.isPending,
85
+ value: () => this.dynamicOptions.value,
86
+ });
87
+
79
88
  get dynamicChoiceOptions() {
80
- return this.dynamicOptions.value ?? [];
89
+ return this.latestDynamicOptions ?? [];
81
90
  }
82
91
 
83
92
  get dynamicMultipleChoiceOptions() {
84
- return this.dynamicOptions.value ?? [];
93
+ return this.latestDynamicOptions ?? [];
85
94
  }
86
95
 
87
96
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-form",
3
- "version": "14.15.0",
3
+ "version": "14.15.2",
4
4
  "description": "Ember addon for rendering Caluma forms.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -28,6 +28,7 @@
28
28
  "ember-intl": "^7.1.1",
29
29
  "ember-math-helpers": "^4.2.1 || ^5.0.0",
30
30
  "ember-power-select": "^8.6.2",
31
+ "ember-resources": "^7.1.0",
31
32
  "ember-template-imports": "^4.2.0",
32
33
  "ember-truth-helpers": "^4.0.3",
33
34
  "ember-uikit": "^9.1.3",
@@ -39,7 +40,7 @@
39
40
  "luxon": "^3.5.0",
40
41
  "reactiveweb": "^1.3.0",
41
42
  "tracked-toolbox": "^2.0.0",
42
- "@projectcaluma/ember-core": "^14.15.0"
43
+ "@projectcaluma/ember-core": "^14.15.2"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@ember/optional-features": "3.0.0",
@@ -74,12 +75,12 @@
74
75
  "uikit": "3.25.6",
75
76
  "uuid": "14.0.1",
76
77
  "webpack": "5.109.2",
77
- "@projectcaluma/ember-workflow": "14.15.0",
78
- "@projectcaluma/ember-testing": "14.15.0"
78
+ "@projectcaluma/ember-testing": "14.15.2",
79
+ "@projectcaluma/ember-workflow": "14.15.2"
79
80
  },
80
81
  "peerDependencies": {
81
82
  "ember-source": ">= 4.0.0",
82
- "@projectcaluma/ember-workflow": "^14.15.0"
83
+ "@projectcaluma/ember-workflow": "^14.15.2"
83
84
  },
84
85
  "dependenciesMeta": {
85
86
  "@projectcaluma/ember-core": {