@inseefr/lunatic 3.6.4 → 3.6.6

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.
Files changed (51) hide show
  1. package/components/CheckboxGroup/CustomCheckboxGroup.d.ts +1 -1
  2. package/components/CheckboxGroup/CustomCheckboxGroup.js.map +1 -1
  3. package/components/Roundabout/CustomRoundabout.js +2 -2
  4. package/components/Roundabout/CustomRoundabout.js.map +1 -1
  5. package/components/Roundabout/roundabout.spec.js +22 -0
  6. package/components/Roundabout/roundabout.spec.js.map +1 -1
  7. package/components/shared/Checkbox/CheckboxOption.d.ts +4 -2
  8. package/components/shared/Checkbox/CheckboxOption.js.map +1 -1
  9. package/components/shared/Radio/RadioGroup.d.ts +1 -1
  10. package/components/shared/Radio/RadioGroup.js.map +1 -1
  11. package/esm/components/CheckboxGroup/CustomCheckboxGroup.d.ts +1 -1
  12. package/esm/components/CheckboxGroup/CustomCheckboxGroup.js.map +1 -1
  13. package/esm/components/Roundabout/CustomRoundabout.js +2 -2
  14. package/esm/components/Roundabout/CustomRoundabout.js.map +1 -1
  15. package/esm/components/Roundabout/roundabout.spec.js +22 -0
  16. package/esm/components/Roundabout/roundabout.spec.js.map +1 -1
  17. package/esm/components/shared/Checkbox/CheckboxOption.d.ts +4 -2
  18. package/esm/components/shared/Checkbox/CheckboxOption.js.map +1 -1
  19. package/esm/components/shared/Radio/RadioGroup.d.ts +1 -1
  20. package/esm/components/shared/Radio/RadioGroup.js.map +1 -1
  21. package/esm/type.source.d.ts +1 -0
  22. package/esm/type.source.js +1 -0
  23. package/esm/type.source.js.map +1 -1
  24. package/esm/use-lunatic/commons/compile-controls.js +25 -7
  25. package/esm/use-lunatic/commons/compile-controls.js.map +1 -1
  26. package/esm/use-lunatic/commons/variables/lunatic-variables-store.js +2 -1
  27. package/esm/use-lunatic/commons/variables/lunatic-variables-store.js.map +1 -1
  28. package/esm/use-lunatic/commons/variables/lunatic-variables-store.spec.js +1 -1
  29. package/esm/use-lunatic/commons/variables/lunatic-variables-store.spec.js.map +1 -1
  30. package/package.json +2 -1
  31. package/src/components/CheckboxGroup/CustomCheckboxGroup.tsx +1 -0
  32. package/src/components/Roundabout/CustomRoundabout.tsx +11 -1
  33. package/src/components/Roundabout/roundabout.spec.tsx +38 -0
  34. package/src/components/shared/Checkbox/CheckboxOption.tsx +3 -2
  35. package/src/components/shared/Radio/RadioGroup.tsx +1 -0
  36. package/src/stories/roundabout/roundabout.stories.tsx +13 -0
  37. package/src/stories/roundabout/sourceWithControl.json +599 -0
  38. package/src/type.source.ts +2 -0
  39. package/src/use-lunatic/commons/compile-controls.ts +47 -11
  40. package/src/use-lunatic/commons/variables/lunatic-variables-store.spec.ts +1 -1
  41. package/src/use-lunatic/commons/variables/lunatic-variables-store.ts +3 -1
  42. package/tsconfig.build.tsbuildinfo +1 -1
  43. package/type.source.d.ts +1 -0
  44. package/type.source.js +1 -0
  45. package/type.source.js.map +1 -1
  46. package/use-lunatic/commons/compile-controls.js +24 -7
  47. package/use-lunatic/commons/compile-controls.js.map +1 -1
  48. package/use-lunatic/commons/variables/lunatic-variables-store.js +2 -1
  49. package/use-lunatic/commons/variables/lunatic-variables-store.js.map +1 -1
  50. package/use-lunatic/commons/variables/lunatic-variables-store.spec.js +1 -1
  51. package/use-lunatic/commons/variables/lunatic-variables-store.spec.js.map +1 -1
@@ -95,7 +95,7 @@ describe('lunatic-variables-store', () => {
95
95
  variables.set('LASTNAME', 'Doe');
96
96
  expect(variables.run('FIRSTNAME || " " || LASTNAME')).toEqual('John Doe');
97
97
  expect(variables.run('FIRSTNAME || " " || LASTNAME')).toEqual('John Doe');
98
- expect(variables.interpretCount).toBe(2);
98
+ expect(variables.interpretCount).toBe(1); // only once computation since improvment of caching result
99
99
  variables.set('FIRSTNAME', 'Jane');
100
100
  expect(variables.run('FIRSTNAME || " " || LASTNAME')).toEqual('Jane Doe');
101
101
  });
@@ -384,7 +384,9 @@ class LunaticVariable {
384
384
  if (hasNoBinding) {
385
385
  iteration = undefined;
386
386
  }
387
- if (this.shapeFrom && !this.isOutdated(iteration)) {
387
+
388
+ const checkCache = this.shapeFrom || iteration === undefined;
389
+ if (checkCache && !this.isOutdated(iteration)) {
388
390
  return this.getSavedValue(iteration);
389
391
  }
390
392
  if (isTestEnv()) {