@contember/react-binding 2.0.0-alpha.15 → 2.0.0-alpha.17

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 (400) hide show
  1. package/dist/development/index.cjs +2 -9
  2. package/dist/development/index.cjs.map +1 -1
  3. package/dist/development/index.js +1 -8
  4. package/dist/development/index.js.map +1 -1
  5. package/dist/development/src/accessorPropagation/AccessorProvider.cjs +1 -1
  6. package/dist/development/src/accessorPropagation/AccessorProvider.cjs.map +1 -1
  7. package/dist/development/src/accessorPropagation/AccessorProvider.js +1 -1
  8. package/dist/development/src/accessorPropagation/AccessorProvider.js.map +1 -1
  9. package/dist/development/src/accessorPropagation/BindingOperationsContext.cjs +2 -1
  10. package/dist/development/src/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
  11. package/dist/development/src/accessorPropagation/BindingOperationsContext.js +2 -1
  12. package/dist/development/src/accessorPropagation/BindingOperationsContext.js.map +1 -1
  13. package/dist/development/src/accessorPropagation/EntityKeyContext.cjs.map +1 -1
  14. package/dist/development/src/accessorPropagation/EntityKeyContext.js.map +1 -1
  15. package/dist/development/src/accessorPropagation/EntityKeyProvider.cjs +1 -1
  16. package/dist/development/src/accessorPropagation/EntityKeyProvider.cjs.map +1 -1
  17. package/dist/development/src/accessorPropagation/EntityKeyProvider.js +1 -1
  18. package/dist/development/src/accessorPropagation/EntityKeyProvider.js.map +1 -1
  19. package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.cjs +14 -37
  20. package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.cjs.map +1 -1
  21. package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.js +15 -38
  22. package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
  23. package/dist/development/src/accessorPropagation/useEntity.cjs +4 -4
  24. package/dist/development/src/accessorPropagation/useEntity.cjs.map +1 -1
  25. package/dist/development/src/accessorPropagation/useEntity.js +4 -4
  26. package/dist/development/src/accessorPropagation/useEntity.js.map +1 -1
  27. package/dist/development/src/accessorPropagation/useEntityKey.cjs.map +1 -1
  28. package/dist/development/src/accessorPropagation/useEntityKey.js.map +1 -1
  29. package/dist/development/src/accessorPropagation/useEntityList.cjs +3 -3
  30. package/dist/development/src/accessorPropagation/useEntityList.cjs.map +1 -1
  31. package/dist/development/src/accessorPropagation/useEntityList.js +3 -3
  32. package/dist/development/src/accessorPropagation/useEntityList.js.map +1 -1
  33. package/dist/development/src/accessorPropagation/useEntityListSubTree.cjs +1 -1
  34. package/dist/development/src/accessorPropagation/useEntityListSubTree.cjs.map +1 -1
  35. package/dist/development/src/accessorPropagation/useEntityListSubTree.js +1 -1
  36. package/dist/development/src/accessorPropagation/useEntityListSubTree.js.map +1 -1
  37. package/dist/development/src/accessorPropagation/useEntitySubTree.cjs +1 -1
  38. package/dist/development/src/accessorPropagation/useEntitySubTree.cjs.map +1 -1
  39. package/dist/development/src/accessorPropagation/useEntitySubTree.js +1 -1
  40. package/dist/development/src/accessorPropagation/useEntitySubTree.js.map +1 -1
  41. package/dist/development/src/accessorPropagation/useField.cjs +3 -3
  42. package/dist/development/src/accessorPropagation/useField.cjs.map +1 -1
  43. package/dist/development/src/accessorPropagation/useField.js +3 -3
  44. package/dist/development/src/accessorPropagation/useField.js.map +1 -1
  45. package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.cjs +2 -2
  46. package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.cjs.map +1 -1
  47. package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.js +2 -2
  48. package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  49. package/dist/development/src/accessorSorting/addEntityAtIndex.cjs +1 -1
  50. package/dist/development/src/accessorSorting/addEntityAtIndex.cjs.map +1 -1
  51. package/dist/development/src/accessorSorting/addEntityAtIndex.js +1 -1
  52. package/dist/development/src/accessorSorting/addEntityAtIndex.js.map +1 -1
  53. package/dist/development/src/accessorSorting/repairEntitiesOrder.cjs +1 -1
  54. package/dist/development/src/accessorSorting/repairEntitiesOrder.cjs.map +1 -1
  55. package/dist/development/src/accessorSorting/repairEntitiesOrder.js +1 -1
  56. package/dist/development/src/accessorSorting/repairEntitiesOrder.js.map +1 -1
  57. package/dist/development/src/accessorSorting/sortEntities.cjs +2 -2
  58. package/dist/development/src/accessorSorting/sortEntities.cjs.map +1 -1
  59. package/dist/development/src/accessorSorting/sortEntities.js +2 -2
  60. package/dist/development/src/accessorSorting/sortEntities.js.map +1 -1
  61. package/dist/development/src/accessorTree/AccessorTree.cjs +16 -6
  62. package/dist/development/src/accessorTree/AccessorTree.cjs.map +1 -1
  63. package/dist/development/src/accessorTree/AccessorTree.js +16 -6
  64. package/dist/development/src/accessorTree/AccessorTree.js.map +1 -1
  65. package/dist/development/src/accessorTree/useDataBinding.cjs +23 -36
  66. package/dist/development/src/accessorTree/useDataBinding.cjs.map +1 -1
  67. package/dist/development/src/accessorTree/useDataBinding.js +26 -39
  68. package/dist/development/src/accessorTree/useDataBinding.js.map +1 -1
  69. package/dist/development/src/accessorTree/useEnvironmentWithSchema.cjs +31 -0
  70. package/dist/development/src/accessorTree/useEnvironmentWithSchema.cjs.map +1 -0
  71. package/dist/development/src/accessorTree/useEnvironmentWithSchema.js +31 -0
  72. package/dist/development/src/accessorTree/useEnvironmentWithSchema.js.map +1 -0
  73. package/dist/development/src/coreComponents/Component.cjs.map +1 -1
  74. package/dist/development/src/coreComponents/Component.js.map +1 -1
  75. package/dist/development/src/coreComponents/DataBindingProvider.cjs +4 -14
  76. package/dist/development/src/coreComponents/DataBindingProvider.cjs.map +1 -1
  77. package/dist/development/src/coreComponents/DataBindingProvider.js +4 -14
  78. package/dist/development/src/coreComponents/DataBindingProvider.js.map +1 -1
  79. package/dist/development/src/coreComponents/EntityListSubTree.cjs +5 -14
  80. package/dist/development/src/coreComponents/EntityListSubTree.cjs.map +1 -1
  81. package/dist/development/src/coreComponents/EntityListSubTree.js +5 -14
  82. package/dist/development/src/coreComponents/EntityListSubTree.js.map +1 -1
  83. package/dist/development/src/coreComponents/EntitySubTree.cjs +7 -16
  84. package/dist/development/src/coreComponents/EntitySubTree.cjs.map +1 -1
  85. package/dist/development/src/coreComponents/EntitySubTree.js +7 -16
  86. package/dist/development/src/coreComponents/EntitySubTree.js.map +1 -1
  87. package/dist/development/src/entityEvents/useDerivedField.cjs +3 -3
  88. package/dist/development/src/entityEvents/useDerivedField.cjs.map +1 -1
  89. package/dist/development/src/entityEvents/useDerivedField.js +3 -3
  90. package/dist/development/src/entityEvents/useDerivedField.js.map +1 -1
  91. package/dist/development/src/helperComponents/DeferredSubTrees.cjs +2 -3
  92. package/dist/development/src/helperComponents/DeferredSubTrees.cjs.map +1 -1
  93. package/dist/development/src/helperComponents/DeferredSubTrees.js +3 -4
  94. package/dist/development/src/helperComponents/DeferredSubTrees.js.map +1 -1
  95. package/dist/development/src/helperComponents/FieldView.cjs +1 -1
  96. package/dist/development/src/helperComponents/FieldView.cjs.map +1 -1
  97. package/dist/development/src/helperComponents/FieldView.js +1 -1
  98. package/dist/development/src/helperComponents/FieldView.js.map +1 -1
  99. package/dist/development/src/markers/IncrementalMarkerBuilder.cjs +56 -0
  100. package/dist/development/src/markers/IncrementalMarkerBuilder.cjs.map +1 -0
  101. package/dist/development/src/markers/IncrementalMarkerBuilder.js +56 -0
  102. package/dist/development/src/markers/IncrementalMarkerBuilder.js.map +1 -0
  103. package/dist/development/src/markers/MarkerStaticAnalyzer.cjs +110 -0
  104. package/dist/development/src/markers/MarkerStaticAnalyzer.cjs.map +1 -0
  105. package/dist/development/src/markers/MarkerStaticAnalyzer.js +110 -0
  106. package/dist/development/src/markers/MarkerStaticAnalyzer.js.map +1 -0
  107. package/dist/development/src/markers/MarkerTreeGenerator.cjs +52 -0
  108. package/dist/development/src/markers/MarkerTreeGenerator.cjs.map +1 -0
  109. package/dist/development/src/markers/MarkerTreeGenerator.js +52 -0
  110. package/dist/development/src/markers/MarkerTreeGenerator.js.map +1 -0
  111. package/dist/production/index.cjs +2 -9
  112. package/dist/production/index.cjs.map +1 -1
  113. package/dist/production/index.js +1 -8
  114. package/dist/production/index.js.map +1 -1
  115. package/dist/production/src/accessorPropagation/AccessorProvider.cjs +1 -1
  116. package/dist/production/src/accessorPropagation/AccessorProvider.cjs.map +1 -1
  117. package/dist/production/src/accessorPropagation/AccessorProvider.js +1 -1
  118. package/dist/production/src/accessorPropagation/AccessorProvider.js.map +1 -1
  119. package/dist/production/src/accessorPropagation/BindingOperationsContext.cjs +2 -1
  120. package/dist/production/src/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
  121. package/dist/production/src/accessorPropagation/BindingOperationsContext.js +2 -1
  122. package/dist/production/src/accessorPropagation/BindingOperationsContext.js.map +1 -1
  123. package/dist/production/src/accessorPropagation/EntityKeyContext.cjs.map +1 -1
  124. package/dist/production/src/accessorPropagation/EntityKeyContext.js.map +1 -1
  125. package/dist/production/src/accessorPropagation/EntityKeyProvider.cjs.map +1 -1
  126. package/dist/production/src/accessorPropagation/EntityKeyProvider.js.map +1 -1
  127. package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.cjs +14 -37
  128. package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.cjs.map +1 -1
  129. package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.js +15 -38
  130. package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
  131. package/dist/production/src/accessorPropagation/useEntity.cjs +4 -4
  132. package/dist/production/src/accessorPropagation/useEntity.cjs.map +1 -1
  133. package/dist/production/src/accessorPropagation/useEntity.js +4 -4
  134. package/dist/production/src/accessorPropagation/useEntity.js.map +1 -1
  135. package/dist/production/src/accessorPropagation/useEntityKey.cjs.map +1 -1
  136. package/dist/production/src/accessorPropagation/useEntityKey.js.map +1 -1
  137. package/dist/production/src/accessorPropagation/useEntityList.cjs +3 -3
  138. package/dist/production/src/accessorPropagation/useEntityList.cjs.map +1 -1
  139. package/dist/production/src/accessorPropagation/useEntityList.js +3 -3
  140. package/dist/production/src/accessorPropagation/useEntityList.js.map +1 -1
  141. package/dist/production/src/accessorPropagation/useEntityListSubTree.cjs +1 -1
  142. package/dist/production/src/accessorPropagation/useEntityListSubTree.cjs.map +1 -1
  143. package/dist/production/src/accessorPropagation/useEntityListSubTree.js +1 -1
  144. package/dist/production/src/accessorPropagation/useEntityListSubTree.js.map +1 -1
  145. package/dist/production/src/accessorPropagation/useEntitySubTree.cjs +1 -1
  146. package/dist/production/src/accessorPropagation/useEntitySubTree.cjs.map +1 -1
  147. package/dist/production/src/accessorPropagation/useEntitySubTree.js +1 -1
  148. package/dist/production/src/accessorPropagation/useEntitySubTree.js.map +1 -1
  149. package/dist/production/src/accessorPropagation/useField.cjs +3 -3
  150. package/dist/production/src/accessorPropagation/useField.cjs.map +1 -1
  151. package/dist/production/src/accessorPropagation/useField.js +3 -3
  152. package/dist/production/src/accessorPropagation/useField.js.map +1 -1
  153. package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.cjs +2 -2
  154. package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.cjs.map +1 -1
  155. package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.js +2 -2
  156. package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  157. package/dist/production/src/accessorSorting/addEntityAtIndex.cjs +1 -1
  158. package/dist/production/src/accessorSorting/addEntityAtIndex.cjs.map +1 -1
  159. package/dist/production/src/accessorSorting/addEntityAtIndex.js +1 -1
  160. package/dist/production/src/accessorSorting/addEntityAtIndex.js.map +1 -1
  161. package/dist/production/src/accessorSorting/repairEntitiesOrder.cjs +1 -1
  162. package/dist/production/src/accessorSorting/repairEntitiesOrder.cjs.map +1 -1
  163. package/dist/production/src/accessorSorting/repairEntitiesOrder.js +1 -1
  164. package/dist/production/src/accessorSorting/repairEntitiesOrder.js.map +1 -1
  165. package/dist/production/src/accessorSorting/sortEntities.cjs +2 -2
  166. package/dist/production/src/accessorSorting/sortEntities.cjs.map +1 -1
  167. package/dist/production/src/accessorSorting/sortEntities.js +2 -2
  168. package/dist/production/src/accessorSorting/sortEntities.js.map +1 -1
  169. package/dist/production/src/accessorTree/AccessorTree.cjs +3 -1
  170. package/dist/production/src/accessorTree/AccessorTree.cjs.map +1 -1
  171. package/dist/production/src/accessorTree/AccessorTree.js +3 -1
  172. package/dist/production/src/accessorTree/AccessorTree.js.map +1 -1
  173. package/dist/production/src/accessorTree/useDataBinding.cjs +23 -36
  174. package/dist/production/src/accessorTree/useDataBinding.cjs.map +1 -1
  175. package/dist/production/src/accessorTree/useDataBinding.js +26 -39
  176. package/dist/production/src/accessorTree/useDataBinding.js.map +1 -1
  177. package/dist/production/src/accessorTree/useEnvironmentWithSchema.cjs +31 -0
  178. package/dist/production/src/accessorTree/useEnvironmentWithSchema.cjs.map +1 -0
  179. package/dist/production/src/accessorTree/useEnvironmentWithSchema.js +31 -0
  180. package/dist/production/src/accessorTree/useEnvironmentWithSchema.js.map +1 -0
  181. package/dist/production/src/coreComponents/Component.cjs.map +1 -1
  182. package/dist/production/src/coreComponents/Component.js.map +1 -1
  183. package/dist/production/src/coreComponents/DataBindingProvider.cjs +3 -5
  184. package/dist/production/src/coreComponents/DataBindingProvider.cjs.map +1 -1
  185. package/dist/production/src/coreComponents/DataBindingProvider.js +3 -5
  186. package/dist/production/src/coreComponents/DataBindingProvider.js.map +1 -1
  187. package/dist/production/src/coreComponents/EntityListSubTree.cjs +2 -11
  188. package/dist/production/src/coreComponents/EntityListSubTree.cjs.map +1 -1
  189. package/dist/production/src/coreComponents/EntityListSubTree.js +2 -11
  190. package/dist/production/src/coreComponents/EntityListSubTree.js.map +1 -1
  191. package/dist/production/src/coreComponents/EntitySubTree.cjs +2 -11
  192. package/dist/production/src/coreComponents/EntitySubTree.cjs.map +1 -1
  193. package/dist/production/src/coreComponents/EntitySubTree.js +2 -11
  194. package/dist/production/src/coreComponents/EntitySubTree.js.map +1 -1
  195. package/dist/production/src/entityEvents/useDerivedField.cjs +3 -3
  196. package/dist/production/src/entityEvents/useDerivedField.cjs.map +1 -1
  197. package/dist/production/src/entityEvents/useDerivedField.js +3 -3
  198. package/dist/production/src/entityEvents/useDerivedField.js.map +1 -1
  199. package/dist/production/src/helperComponents/DeferredSubTrees.cjs +2 -3
  200. package/dist/production/src/helperComponents/DeferredSubTrees.cjs.map +1 -1
  201. package/dist/production/src/helperComponents/DeferredSubTrees.js +3 -4
  202. package/dist/production/src/helperComponents/DeferredSubTrees.js.map +1 -1
  203. package/dist/production/src/helperComponents/FieldView.cjs +1 -1
  204. package/dist/production/src/helperComponents/FieldView.cjs.map +1 -1
  205. package/dist/production/src/helperComponents/FieldView.js +1 -1
  206. package/dist/production/src/helperComponents/FieldView.js.map +1 -1
  207. package/dist/production/src/markers/IncrementalMarkerBuilder.cjs +56 -0
  208. package/dist/production/src/markers/IncrementalMarkerBuilder.cjs.map +1 -0
  209. package/dist/production/src/markers/IncrementalMarkerBuilder.js +56 -0
  210. package/dist/production/src/markers/IncrementalMarkerBuilder.js.map +1 -0
  211. package/dist/production/src/markers/MarkerStaticAnalyzer.cjs +110 -0
  212. package/dist/production/src/markers/MarkerStaticAnalyzer.cjs.map +1 -0
  213. package/dist/production/src/markers/MarkerStaticAnalyzer.js +110 -0
  214. package/dist/production/src/markers/MarkerStaticAnalyzer.js.map +1 -0
  215. package/dist/production/src/markers/MarkerTreeGenerator.cjs +52 -0
  216. package/dist/production/src/markers/MarkerTreeGenerator.cjs.map +1 -0
  217. package/dist/production/src/markers/MarkerTreeGenerator.js +52 -0
  218. package/dist/production/src/markers/MarkerTreeGenerator.js.map +1 -0
  219. package/dist/types/accessorPropagation/BindingOperationsContext.d.ts +1 -1
  220. package/dist/types/accessorPropagation/BindingOperationsContext.d.ts.map +1 -1
  221. package/dist/types/accessorPropagation/EntityKeyContext.d.ts +2 -1
  222. package/dist/types/accessorPropagation/EntityKeyContext.d.ts.map +1 -1
  223. package/dist/types/accessorPropagation/EntityKeyProvider.d.ts +2 -1
  224. package/dist/types/accessorPropagation/EntityKeyProvider.d.ts.map +1 -1
  225. package/dist/types/accessorPropagation/EnvironmentContext.d.ts +2 -2
  226. package/dist/types/accessorPropagation/EnvironmentContext.d.ts.map +1 -1
  227. package/dist/types/accessorPropagation/TreeRootIdContext.d.ts +1 -1
  228. package/dist/types/accessorPropagation/TreeRootIdContext.d.ts.map +1 -1
  229. package/dist/types/accessorPropagation/useAccessorUpdateSubscription.d.ts +7 -12
  230. package/dist/types/accessorPropagation/useAccessorUpdateSubscription.d.ts.map +1 -1
  231. package/dist/types/accessorPropagation/useEntityKey.d.ts +2 -1
  232. package/dist/types/accessorPropagation/useEntityKey.d.ts.map +1 -1
  233. package/dist/types/accessorPropagation/useEntitySubTree.d.ts +1 -2
  234. package/dist/types/accessorPropagation/useEntitySubTree.d.ts.map +1 -1
  235. package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts +1 -1
  236. package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts.map +1 -1
  237. package/dist/types/accessorSorting/index.d.ts +0 -2
  238. package/dist/types/accessorSorting/index.d.ts.map +1 -1
  239. package/dist/types/accessorTree/AccessorTree.d.ts.map +1 -1
  240. package/dist/types/accessorTree/AccessorTreeState.d.ts +1 -4
  241. package/dist/types/accessorTree/AccessorTreeState.d.ts.map +1 -1
  242. package/dist/types/accessorTree/AccessorTreeStateContext.d.ts +1 -1
  243. package/dist/types/accessorTree/AccessorTreeStateContext.d.ts.map +1 -1
  244. package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts +0 -2
  245. package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts.map +1 -1
  246. package/dist/types/accessorTree/DirtinessContext.d.ts +1 -1
  247. package/dist/types/accessorTree/DirtinessContext.d.ts.map +1 -1
  248. package/dist/types/accessorTree/MutationStateContext.d.ts +1 -1
  249. package/dist/types/accessorTree/MutationStateContext.d.ts.map +1 -1
  250. package/dist/types/accessorTree/index.d.ts +0 -1
  251. package/dist/types/accessorTree/index.d.ts.map +1 -1
  252. package/dist/types/accessorTree/useDataBinding.d.ts +6 -2
  253. package/dist/types/accessorTree/useDataBinding.d.ts.map +1 -1
  254. package/dist/types/accessorTree/useEnvironmentWithSchema.d.ts +3 -0
  255. package/dist/types/accessorTree/useEnvironmentWithSchema.d.ts.map +1 -0
  256. package/dist/types/coreComponents/Component.d.ts +1 -1
  257. package/dist/types/coreComponents/Component.d.ts.map +1 -1
  258. package/dist/types/coreComponents/DataBindingProvider.d.ts +8 -8
  259. package/dist/types/coreComponents/DataBindingProvider.d.ts.map +1 -1
  260. package/dist/types/coreComponents/Entity.d.ts +1 -1
  261. package/dist/types/coreComponents/Entity.d.ts.map +1 -1
  262. package/dist/types/coreComponents/EntityListSubTree.d.ts +1 -1
  263. package/dist/types/coreComponents/EntityListSubTree.d.ts.map +1 -1
  264. package/dist/types/coreComponents/EntitySubTree.d.ts +1 -1
  265. package/dist/types/coreComponents/EntitySubTree.d.ts.map +1 -1
  266. package/dist/types/coreComponents/ParentEntity.d.ts +1 -1
  267. package/dist/types/coreComponents/ParentEntity.d.ts.map +1 -1
  268. package/dist/types/coreComponents/index.d.ts +0 -1
  269. package/dist/types/coreComponents/index.d.ts.map +1 -1
  270. package/dist/types/helperComponents/DeferredSubTrees.d.ts +1 -1
  271. package/dist/types/helperComponents/DeferredSubTrees.d.ts.map +1 -1
  272. package/dist/types/helperComponents/If.d.ts +1 -1
  273. package/dist/types/helperComponents/If.d.ts.map +1 -1
  274. package/dist/types/helperComponents/LabelMiddleware.d.ts +1 -1
  275. package/dist/types/helperComponents/LabelMiddleware.d.ts.map +1 -1
  276. package/dist/types/helperComponents/StaticRender.d.ts +1 -1
  277. package/dist/types/helperComponents/StaticRender.d.ts.map +1 -1
  278. package/dist/types/helperComponents/Variable.d.ts +1 -1
  279. package/dist/types/helperComponents/Variable.d.ts.map +1 -1
  280. package/dist/types/index.d.ts +1 -1
  281. package/dist/types/index.d.ts.map +1 -1
  282. package/dist/types/markers/IncrementalMarkerBuilder.d.ts +5 -0
  283. package/dist/types/markers/IncrementalMarkerBuilder.d.ts.map +1 -0
  284. package/dist/types/{coreComponents → markers}/MarkerProvider.d.ts +1 -2
  285. package/dist/types/markers/MarkerProvider.d.ts.map +1 -0
  286. package/dist/types/markers/MarkerStaticAnalyzer.d.ts +14 -0
  287. package/dist/types/markers/MarkerStaticAnalyzer.d.ts.map +1 -0
  288. package/dist/types/markers/MarkerTreeGenerator.d.ts +10 -0
  289. package/dist/types/markers/MarkerTreeGenerator.d.ts.map +1 -0
  290. package/dist/types/markers/index.d.ts +3 -0
  291. package/dist/types/markers/index.d.ts.map +1 -0
  292. package/dist/types/tsconfig.tsbuildinfo +1 -1
  293. package/package.json +9 -8
  294. package/src/accessorPropagation/AccessorProvider.tsx +1 -1
  295. package/src/accessorPropagation/BindingOperationsContext.ts +1 -0
  296. package/src/accessorPropagation/EntityKeyContext.ts +2 -1
  297. package/src/accessorPropagation/EntityKeyProvider.tsx +2 -1
  298. package/src/accessorPropagation/useAccessorUpdateSubscription.ts +19 -87
  299. package/src/accessorPropagation/useEntity.ts +4 -4
  300. package/src/accessorPropagation/useEntityKey.ts +2 -2
  301. package/src/accessorPropagation/useEntityList.ts +3 -3
  302. package/src/accessorPropagation/useEntityListSubTree.ts +1 -1
  303. package/src/accessorPropagation/useEntitySubTree.ts +3 -4
  304. package/src/accessorPropagation/useField.ts +3 -3
  305. package/src/accessorSorting/SetOrderFieldOnCreate.tsx +2 -2
  306. package/src/accessorSorting/addEntityAtIndex.ts +1 -1
  307. package/src/accessorSorting/index.ts +0 -2
  308. package/src/accessorSorting/repairEntitiesOrder.ts +1 -1
  309. package/src/accessorSorting/sortEntities.ts +2 -2
  310. package/src/accessorTree/AccessorTree.tsx +17 -12
  311. package/src/accessorTree/AccessorTreeState.ts +1 -4
  312. package/src/accessorTree/AccessorTreeStateOptions.ts +0 -2
  313. package/src/accessorTree/index.ts +0 -1
  314. package/src/accessorTree/useDataBinding.ts +35 -44
  315. package/src/accessorTree/useEnvironmentWithSchema.ts +31 -0
  316. package/src/coreComponents/Component.tsx +2 -2
  317. package/src/coreComponents/DataBindingProvider.tsx +22 -35
  318. package/src/coreComponents/EntityListSubTree.tsx +4 -18
  319. package/src/coreComponents/EntitySubTree.tsx +5 -20
  320. package/src/coreComponents/index.ts +0 -1
  321. package/src/entityEvents/useDerivedField.ts +3 -3
  322. package/src/helperComponents/DeferredSubTrees.tsx +1 -5
  323. package/src/helperComponents/FieldView.tsx +1 -1
  324. package/src/index.ts +1 -1
  325. package/src/markers/IncrementalMarkerBuilder.ts +60 -0
  326. package/src/{coreComponents → markers}/MarkerProvider.ts +2 -2
  327. package/src/markers/MarkerStaticAnalyzer.ts +132 -0
  328. package/src/markers/MarkerTreeGenerator.ts +72 -0
  329. package/src/markers/index.ts +2 -0
  330. package/src/tsconfig.json +2 -1
  331. package/src/typings/react-fix.d.ts +12 -0
  332. package/tests/cases/unit/model/markerTreeGenerator.spec.tsx +44 -9
  333. package/tests/lib/bindingFactory.ts +1 -1
  334. package/dist/development/src/MarkerTreeGenerator.cjs +0 -89
  335. package/dist/development/src/MarkerTreeGenerator.cjs.map +0 -1
  336. package/dist/development/src/MarkerTreeGenerator.js +0 -89
  337. package/dist/development/src/MarkerTreeGenerator.js.map +0 -1
  338. package/dist/development/src/accessorSorting/errors.cjs +0 -10
  339. package/dist/development/src/accessorSorting/errors.cjs.map +0 -1
  340. package/dist/development/src/accessorSorting/errors.js +0 -10
  341. package/dist/development/src/accessorSorting/errors.js.map +0 -1
  342. package/dist/development/src/accessorSorting/moveEntity.cjs +0 -42
  343. package/dist/development/src/accessorSorting/moveEntity.cjs.map +0 -1
  344. package/dist/development/src/accessorSorting/moveEntity.js +0 -42
  345. package/dist/development/src/accessorSorting/moveEntity.js.map +0 -1
  346. package/dist/development/src/accessorSorting/useSortedEntities.cjs +0 -80
  347. package/dist/development/src/accessorSorting/useSortedEntities.cjs.map +0 -1
  348. package/dist/development/src/accessorSorting/useSortedEntities.js +0 -80
  349. package/dist/development/src/accessorSorting/useSortedEntities.js.map +0 -1
  350. package/dist/development/src/accessorTree/accessorTreeStateReducer.cjs +0 -34
  351. package/dist/development/src/accessorTree/accessorTreeStateReducer.cjs.map +0 -1
  352. package/dist/development/src/accessorTree/accessorTreeStateReducer.js +0 -34
  353. package/dist/development/src/accessorTree/accessorTreeStateReducer.js.map +0 -1
  354. package/dist/development/src/core/IncrementalMarkerBuilder.cjs +0 -63
  355. package/dist/development/src/core/IncrementalMarkerBuilder.cjs.map +0 -1
  356. package/dist/development/src/core/IncrementalMarkerBuilder.js +0 -63
  357. package/dist/development/src/core/IncrementalMarkerBuilder.js.map +0 -1
  358. package/dist/production/src/MarkerTreeGenerator.cjs +0 -89
  359. package/dist/production/src/MarkerTreeGenerator.cjs.map +0 -1
  360. package/dist/production/src/MarkerTreeGenerator.js +0 -89
  361. package/dist/production/src/MarkerTreeGenerator.js.map +0 -1
  362. package/dist/production/src/accessorSorting/errors.cjs +0 -10
  363. package/dist/production/src/accessorSorting/errors.cjs.map +0 -1
  364. package/dist/production/src/accessorSorting/errors.js +0 -10
  365. package/dist/production/src/accessorSorting/errors.js.map +0 -1
  366. package/dist/production/src/accessorSorting/moveEntity.cjs +0 -42
  367. package/dist/production/src/accessorSorting/moveEntity.cjs.map +0 -1
  368. package/dist/production/src/accessorSorting/moveEntity.js +0 -42
  369. package/dist/production/src/accessorSorting/moveEntity.js.map +0 -1
  370. package/dist/production/src/accessorSorting/useSortedEntities.cjs +0 -80
  371. package/dist/production/src/accessorSorting/useSortedEntities.cjs.map +0 -1
  372. package/dist/production/src/accessorSorting/useSortedEntities.js +0 -80
  373. package/dist/production/src/accessorSorting/useSortedEntities.js.map +0 -1
  374. package/dist/production/src/accessorTree/accessorTreeStateReducer.cjs +0 -34
  375. package/dist/production/src/accessorTree/accessorTreeStateReducer.cjs.map +0 -1
  376. package/dist/production/src/accessorTree/accessorTreeStateReducer.js +0 -34
  377. package/dist/production/src/accessorTree/accessorTreeStateReducer.js.map +0 -1
  378. package/dist/production/src/core/IncrementalMarkerBuilder.cjs +0 -63
  379. package/dist/production/src/core/IncrementalMarkerBuilder.cjs.map +0 -1
  380. package/dist/production/src/core/IncrementalMarkerBuilder.js +0 -63
  381. package/dist/production/src/core/IncrementalMarkerBuilder.js.map +0 -1
  382. package/dist/types/MarkerTreeGenerator.d.ts +0 -14
  383. package/dist/types/MarkerTreeGenerator.d.ts.map +0 -1
  384. package/dist/types/accessorSorting/errors.d.ts +0 -3
  385. package/dist/types/accessorSorting/errors.d.ts.map +0 -1
  386. package/dist/types/accessorSorting/moveEntity.d.ts +0 -4
  387. package/dist/types/accessorSorting/moveEntity.d.ts.map +0 -1
  388. package/dist/types/accessorSorting/useSortedEntities.d.ts +0 -5
  389. package/dist/types/accessorSorting/useSortedEntities.d.ts.map +0 -1
  390. package/dist/types/accessorTree/accessorTreeStateReducer.d.ts +0 -4
  391. package/dist/types/accessorTree/accessorTreeStateReducer.d.ts.map +0 -1
  392. package/dist/types/core/IncrementalMarkerBuilder.d.ts +0 -7
  393. package/dist/types/core/IncrementalMarkerBuilder.d.ts.map +0 -1
  394. package/dist/types/coreComponents/MarkerProvider.d.ts.map +0 -1
  395. package/src/MarkerTreeGenerator.ts +0 -121
  396. package/src/accessorSorting/errors.ts +0 -9
  397. package/src/accessorSorting/moveEntity.ts +0 -65
  398. package/src/accessorSorting/useSortedEntities.ts +0 -102
  399. package/src/accessorTree/accessorTreeStateReducer.ts +0 -36
  400. package/src/core/IncrementalMarkerBuilder.ts +0 -64
@@ -1 +1 @@
1
- {"version":3,"file":"BindingOperationsContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tgetTreeFilters: getRejecter('retrieve tree filters'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":[],"mappings":";;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAI;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,gBAAgB,YAAY,uBAAuB;AAAA,EACnD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAC/B,CAAC;AAEY,MAAA,2BAA2B,cAA4C,wBAAwB;"}
1
+ {"version":3,"file":"BindingOperationsContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tgetTreeFilters: getRejecter('retrieve tree filters'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n\tfetchData: getRejecter('fetchData'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":[],"mappings":";;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAI;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,gBAAgB,YAAY,uBAAuB;AAAA,EACnD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAAA,EAC9B,WAAW,YAAY,WAAW;AACnC,CAAC;AAEY,MAAA,2BAA2B,cAA4C,wBAAwB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityKeyContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyContext.ts"],"sourcesContent":["import { createContext } from 'react'\n\nexport const EntityKeyContext = createContext<undefined | string>(undefined)\nEntityKeyContext.displayName = 'EntityKeyContext'\n"],"names":["createContext"],"mappings":";;;AAEa,MAAA,mBAAmBA,MAAAA,cAAkC,MAAS;AAC3E,iBAAiB,cAAc;;"}
1
+ {"version":3,"file":"EntityKeyContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyContext.ts"],"sourcesContent":["import { EntityAccessor } from '@contember/binding-common'\nimport { createContext } from 'react'\n\nexport const EntityKeyContext = createContext<undefined | string | (() => EntityAccessor)>(undefined)\nEntityKeyContext.displayName = 'EntityKeyContext'\n"],"names":["createContext"],"mappings":";;;AAGa,MAAA,mBAAmBA,MAAAA,cAA2D,MAAS;AACpG,iBAAiB,cAAc;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityKeyContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyContext.ts"],"sourcesContent":["import { createContext } from 'react'\n\nexport const EntityKeyContext = createContext<undefined | string>(undefined)\nEntityKeyContext.displayName = 'EntityKeyContext'\n"],"names":[],"mappings":";AAEa,MAAA,mBAAmB,cAAkC,MAAS;AAC3E,iBAAiB,cAAc;"}
1
+ {"version":3,"file":"EntityKeyContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyContext.ts"],"sourcesContent":["import { EntityAccessor } from '@contember/binding-common'\nimport { createContext } from 'react'\n\nexport const EntityKeyContext = createContext<undefined | string | (() => EntityAccessor)>(undefined)\nEntityKeyContext.displayName = 'EntityKeyContext'\n"],"names":[],"mappings":";AAGa,MAAA,mBAAmB,cAA2D,MAAS;AACpG,iBAAiB,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityKeyProvider.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport interface EntityKeyProviderProps {\n\tentityKey: string\n\tchildren: ReactNode\n}\n\nexport function EntityKeyProvider(props: EntityKeyProviderProps) {\n\treturn <EntityKeyContext.Provider value={props.entityKey}>{props.children}</EntityKeyContext.Provider>\n}\n"],"names":["jsx","EntityKeyContext"],"mappings":";;;;AAQO,SAAS,kBAAkB,OAA+B;AACzD,SAAAA,+BAACC,iBAAAA,iBAAiB,UAAjB,EAA0B,OAAO,MAAM,WAAY,gBAAM,SAAS,CAAA;AAC3E;;"}
1
+ {"version":3,"file":"EntityKeyProvider.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\nimport { EntityAccessor } from '@contember/binding'\n\nexport interface EntityKeyProviderProps {\n\tentityKey: string | (() => EntityAccessor)\n\tchildren: ReactNode\n}\n\nexport function EntityKeyProvider(props: EntityKeyProviderProps) {\n\treturn <EntityKeyContext.Provider value={props.entityKey}>{props.children}</EntityKeyContext.Provider>\n}\n"],"names":["jsx","EntityKeyContext"],"mappings":";;;;AASO,SAAS,kBAAkB,OAA+B;AACzD,SAAAA,+BAACC,iBAAAA,iBAAiB,UAAjB,EAA0B,OAAO,MAAM,WAAY,gBAAM,SAAS,CAAA;AAC3E;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityKeyProvider.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport interface EntityKeyProviderProps {\n\tentityKey: string\n\tchildren: ReactNode\n}\n\nexport function EntityKeyProvider(props: EntityKeyProviderProps) {\n\treturn <EntityKeyContext.Provider value={props.entityKey}>{props.children}</EntityKeyContext.Provider>\n}\n"],"names":[],"mappings":";;AAQO,SAAS,kBAAkB,OAA+B;AACzD,SAAA,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,MAAM,WAAY,gBAAM,SAAS,CAAA;AAC3E;"}
1
+ {"version":3,"file":"EntityKeyProvider.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\nimport { EntityAccessor } from '@contember/binding'\n\nexport interface EntityKeyProviderProps {\n\tentityKey: string | (() => EntityAccessor)\n\tchildren: ReactNode\n}\n\nexport function EntityKeyProvider(props: EntityKeyProviderProps) {\n\treturn <EntityKeyContext.Provider value={props.entityKey}>{props.children}</EntityKeyContext.Provider>\n}\n"],"names":[],"mappings":";;AASO,SAAS,kBAAkB,OAA+B;AACzD,SAAA,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,MAAM,WAAY,gBAAM,SAAS,CAAA;AAC3E;"}
@@ -1,55 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const reactUtils = require("@contember/react-utils");
4
3
  const React = require("react");
5
- function useAccessorUpdateSubscription(getAccessor, withForceUpdate) {
6
- const [state, setState] = React.useState(() => ({
7
- accessor: getAccessor(),
8
- getAccessor
9
- }));
10
- reactUtils.useConstantValueInvariant(withForceUpdate, "useAccessorUpdateSubscription: cannot change the withForceUpdate value!");
11
- let accessor = state.accessor;
12
- if (state.getAccessor !== getAccessor) {
13
- setState({
14
- accessor: getAccessor(),
15
- getAccessor
16
- });
4
+ const useAccessorUpdateSubscription = (getAccessor) => {
5
+ const [state, setState] = React.useState(() => getAccessor());
6
+ const getterRef = React.useRef(getAccessor);
7
+ let accessor = state;
8
+ if (getterRef.current !== getAccessor) {
17
9
  accessor = getAccessor();
18
- }
19
- let forceUpdate = void 0;
20
- if (withForceUpdate) {
21
- forceUpdate = React.useCallback(() => {
22
- setState({
23
- accessor: getAccessor(),
24
- getAccessor
25
- });
26
- }, [getAccessor]);
10
+ setState(accessor);
11
+ getterRef.current = getAccessor;
27
12
  }
28
13
  React.useEffect(() => {
29
14
  let isStillSubscribed = true;
30
15
  const unsubscribe = getAccessor().addEventListener({ type: "update" }, (newAccessor) => {
31
- if (!isStillSubscribed) {
16
+ if (!isStillSubscribed || getterRef.current !== getAccessor) {
32
17
  return;
33
18
  }
34
- setState((prevState) => {
35
- if (prevState.getAccessor !== getAccessor || prevState.accessor === newAccessor) {
36
- return prevState;
37
- }
38
- return {
39
- accessor: newAccessor,
40
- getAccessor
41
- };
42
- });
19
+ setState(newAccessor);
43
20
  });
44
21
  return () => {
45
22
  isStillSubscribed = false;
46
23
  unsubscribe();
47
24
  };
48
25
  }, [getAccessor]);
49
- if (withForceUpdate && forceUpdate) {
50
- return [accessor, forceUpdate];
51
- }
52
- return accessor;
53
- }
26
+ const update = React.useCallback(() => {
27
+ setState(getAccessor());
28
+ }, [getAccessor]);
29
+ return [accessor, { update }];
30
+ };
54
31
  exports.useAccessorUpdateSubscription = useAccessorUpdateSubscription;
55
32
  //# sourceMappingURL=useAccessorUpdateSubscription.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAccessorUpdateSubscription.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useAccessorUpdateSubscription.ts"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback, useEffect, useState } from 'react'\nimport type { EntityAccessor, EntityListAccessor, FieldAccessor } from '@contember/binding'\nimport type { FieldValue } from '@contember/binding'\n\nexport type ForceAccessorUpdate = () => void\n\n/**\n * It is VERY IMPORTANT for the parameter to be referentially stable!\n */\nfunction useAccessorUpdateSubscription<Value extends FieldValue = FieldValue>(\n\tgetFieldAccessor: () => FieldAccessor<Value>,\n): FieldAccessor<Value>\nfunction useAccessorUpdateSubscription(getEntityAccessor: () => EntityAccessor): EntityAccessor\nfunction useAccessorUpdateSubscription(getListAccessor: () => EntityListAccessor): EntityListAccessor\nfunction useAccessorUpdateSubscription(\n\tgetAccessor: () => EntityListAccessor | EntityAccessor,\n): EntityListAccessor | EntityAccessor\nfunction useAccessorUpdateSubscription<Value extends FieldValue = FieldValue>(\n\tgetFieldAccessor: () => FieldAccessor<Value>,\n\twithForceUpdate: true,\n): [FieldAccessor<Value>, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription(\n\tgetEntityAccessor: () => EntityAccessor,\n\twithForceUpdate: true,\n): [EntityAccessor, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription(\n\tgetListAccessor: () => EntityListAccessor,\n\twithForceUpdate: true,\n): [EntityListAccessor, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription(\n\tgetAccessor: () => EntityListAccessor | EntityAccessor,\n\twithForceUpdate: true,\n): [EntityListAccessor | EntityAccessor, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription<\n\tA extends FieldAccessor<Value> | EntityListAccessor | EntityAccessor,\n\tValue extends FieldValue = FieldValue,\n>(getAccessor: () => A, withForceUpdate?: true): A | [A, ForceAccessorUpdate] {\n\t// This is *HEAVILY* adopted from https://github.com/facebook/react/blob/master/packages/use-subscription/src/useSubscription.js\n\tconst [state, setState] = useState<{\n\t\taccessor: A\n\t\tgetAccessor: () => A\n\t}>(() => ({\n\t\t\t\taccessor: getAccessor(),\n\t\t\t\tgetAccessor,\n\t\t\t}))\n\n\tuseConstantValueInvariant(withForceUpdate, 'useAccessorUpdateSubscription: cannot change the withForceUpdate value!')\n\n\tlet accessor = state.accessor\n\n\tif (state.getAccessor !== getAccessor) {\n\t\tsetState({\n\t\t\taccessor: getAccessor(),\n\t\t\tgetAccessor,\n\t\t})\n\t\taccessor = getAccessor()\n\t}\n\n\tlet forceUpdate: ForceAccessorUpdate | undefined = undefined\n\tif (withForceUpdate) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tforceUpdate = useCallback(() => {\n\t\t\tsetState({\n\t\t\t\taccessor: getAccessor(),\n\t\t\t\tgetAccessor,\n\t\t\t})\n\t\t}, [getAccessor])\n\t}\n\n\tuseEffect(() => {\n\t\tlet isStillSubscribed = true\n\n\t\tconst unsubscribe = (\n\t\t\tgetAccessor().addEventListener as (\n\t\t\t\teventType: { type: 'update' },\n\t\t\t\thandler: (newAccessor: FieldAccessor<Value> | EntityListAccessor | EntityAccessor) => void,\n\t\t\t) => () => void\n\t\t)({ type: 'update' }, newAccessor => {\n\t\t\tif (!isStillSubscribed) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsetState(prevState => {\n\t\t\t\tif (prevState.getAccessor !== getAccessor || prevState.accessor === newAccessor) {\n\t\t\t\t\treturn prevState\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\taccessor: newAccessor as A,\n\t\t\t\t\tgetAccessor,\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\n\t\treturn () => {\n\t\t\tisStillSubscribed = false\n\t\t\tunsubscribe()\n\t\t}\n\t}, [getAccessor])\n\n\tif (withForceUpdate && forceUpdate) {\n\t\treturn [accessor, forceUpdate]\n\t}\n\treturn accessor\n}\nexport { useAccessorUpdateSubscription }\n"],"names":["useState","useConstantValueInvariant","useCallback","useEffect"],"mappings":";;;;AAkCA,SAAS,8BAGP,aAAsB,iBAAsD;AAE7E,QAAM,CAAC,OAAO,QAAQ,IAAIA,eAGvB,OAAO;AAAA,IACP,UAAU,YAAY;AAAA,IACtB;AAAA,EACC,EAAA;AAEJC,uCAA0B,iBAAiB,yEAAyE;AAEpH,MAAI,WAAW,MAAM;AAEjB,MAAA,MAAM,gBAAgB,aAAa;AAC7B,aAAA;AAAA,MACR,UAAU,YAAY;AAAA,MACtB;AAAA,IAAA,CACA;AACD,eAAW,YAAY;AAAA,EACxB;AAEA,MAAI,cAA+C;AACnD,MAAI,iBAAiB;AAEpB,kBAAcC,kBAAY,MAAM;AACtB,eAAA;AAAA,QACR,UAAU,YAAY;AAAA,QACtB;AAAA,MAAA,CACA;AAAA,IAAA,GACC,CAAC,WAAW,CAAC;AAAA,EACjB;AAEAC,QAAAA,UAAU,MAAM;AACf,QAAI,oBAAoB;AAElB,UAAA,cACL,cAAc,iBAIb,EAAE,MAAM,SAAA,GAAY,CAAe,gBAAA;AACpC,UAAI,CAAC,mBAAmB;AACvB;AAAA,MACD;AAEA,eAAS,CAAa,cAAA;AACrB,YAAI,UAAU,gBAAgB,eAAe,UAAU,aAAa,aAAa;AACzE,iBAAA;AAAA,QACR;AAEO,eAAA;AAAA,UACN,UAAU;AAAA,UACV;AAAA,QAAA;AAAA,MACD,CACA;AAAA,IAAA,CACD;AAED,WAAO,MAAM;AACQ,0BAAA;AACR;IAAA;AAAA,EACb,GACE,CAAC,WAAW,CAAC;AAEhB,MAAI,mBAAmB,aAAa;AAC5B,WAAA,CAAC,UAAU,WAAW;AAAA,EAC9B;AACO,SAAA;AACR;;"}
1
+ {"version":3,"file":"useAccessorUpdateSubscription.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useAccessorUpdateSubscription.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\n\n/**\n * It is VERY IMPORTANT for the parameter to be referentially stable!\n */\nexport const useAccessorUpdateSubscription = <Accessor extends {\n\taddEventListener: (event: { type: 'update' }, cb: (accessor: Accessor) => void) => () => void\n}>(getAccessor: () => Accessor): [Accessor, {update: () => void}] => {\n\tconst [state, setState] = useState<Accessor>(() => getAccessor())\n\tconst getterRef = useRef(getAccessor)\n\n\tlet accessor = state\n\tif (getterRef.current !== getAccessor) {\n\t\taccessor = getAccessor()\n\t\tsetState(accessor)\n\t\tgetterRef.current = getAccessor\n\t}\n\n\tuseEffect(() => {\n\t\tlet isStillSubscribed = true\n\t\tconst unsubscribe = getAccessor().addEventListener({ type: 'update' }, newAccessor => {\n\t\t\tif (!isStillSubscribed || getterRef.current !== getAccessor) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetState(newAccessor)\n\t\t})\n\n\t\treturn () => {\n\t\t\tisStillSubscribed = false\n\t\t\tunsubscribe()\n\t\t}\n\t}, [getAccessor])\n\n\tconst update = useCallback(() => {\n\t\tsetState(getAccessor())\n\t}, [getAccessor])\n\n\treturn [accessor, { update }]\n}\n"],"names":["useState","useRef","useEffect","useCallback"],"mappings":";;;AAKa,MAAA,gCAAgC,CAE1C,gBAAkE;AACpE,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAmB,MAAM,aAAa;AAC1D,QAAA,YAAYC,aAAO,WAAW;AAEpC,MAAI,WAAW;AACX,MAAA,UAAU,YAAY,aAAa;AACtC,eAAW,YAAY;AACvB,aAAS,QAAQ;AACjB,cAAU,UAAU;AAAA,EACrB;AAEAC,QAAAA,UAAU,MAAM;AACf,QAAI,oBAAoB;AAClB,UAAA,cAAc,cAAc,iBAAiB,EAAE,MAAM,SAAA,GAAY,CAAe,gBAAA;AACrF,UAAI,CAAC,qBAAqB,UAAU,YAAY,aAAa;AAC5D;AAAA,MACD;AACA,eAAS,WAAW;AAAA,IAAA,CACpB;AAED,WAAO,MAAM;AACQ,0BAAA;AACR;IAAA;AAAA,EACb,GACE,CAAC,WAAW,CAAC;AAEV,QAAA,SAASC,MAAAA,YAAY,MAAM;AAChC,aAAS,aAAa;AAAA,EAAA,GACpB,CAAC,WAAW,CAAC;AAEhB,SAAO,CAAC,UAAU,EAAE,OAAA,CAAQ;AAC7B;;"}
@@ -1,54 +1,31 @@
1
- import { useConstantValueInvariant } from "@contember/react-utils";
2
- import { useState, useCallback, useEffect } from "react";
3
- function useAccessorUpdateSubscription(getAccessor, withForceUpdate) {
4
- const [state, setState] = useState(() => ({
5
- accessor: getAccessor(),
6
- getAccessor
7
- }));
8
- useConstantValueInvariant(withForceUpdate, "useAccessorUpdateSubscription: cannot change the withForceUpdate value!");
9
- let accessor = state.accessor;
10
- if (state.getAccessor !== getAccessor) {
11
- setState({
12
- accessor: getAccessor(),
13
- getAccessor
14
- });
1
+ import { useState, useRef, useEffect, useCallback } from "react";
2
+ const useAccessorUpdateSubscription = (getAccessor) => {
3
+ const [state, setState] = useState(() => getAccessor());
4
+ const getterRef = useRef(getAccessor);
5
+ let accessor = state;
6
+ if (getterRef.current !== getAccessor) {
15
7
  accessor = getAccessor();
16
- }
17
- let forceUpdate = void 0;
18
- if (withForceUpdate) {
19
- forceUpdate = useCallback(() => {
20
- setState({
21
- accessor: getAccessor(),
22
- getAccessor
23
- });
24
- }, [getAccessor]);
8
+ setState(accessor);
9
+ getterRef.current = getAccessor;
25
10
  }
26
11
  useEffect(() => {
27
12
  let isStillSubscribed = true;
28
13
  const unsubscribe = getAccessor().addEventListener({ type: "update" }, (newAccessor) => {
29
- if (!isStillSubscribed) {
14
+ if (!isStillSubscribed || getterRef.current !== getAccessor) {
30
15
  return;
31
16
  }
32
- setState((prevState) => {
33
- if (prevState.getAccessor !== getAccessor || prevState.accessor === newAccessor) {
34
- return prevState;
35
- }
36
- return {
37
- accessor: newAccessor,
38
- getAccessor
39
- };
40
- });
17
+ setState(newAccessor);
41
18
  });
42
19
  return () => {
43
20
  isStillSubscribed = false;
44
21
  unsubscribe();
45
22
  };
46
23
  }, [getAccessor]);
47
- if (withForceUpdate && forceUpdate) {
48
- return [accessor, forceUpdate];
49
- }
50
- return accessor;
51
- }
24
+ const update = useCallback(() => {
25
+ setState(getAccessor());
26
+ }, [getAccessor]);
27
+ return [accessor, { update }];
28
+ };
52
29
  export {
53
30
  useAccessorUpdateSubscription
54
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useAccessorUpdateSubscription.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useAccessorUpdateSubscription.ts"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback, useEffect, useState } from 'react'\nimport type { EntityAccessor, EntityListAccessor, FieldAccessor } from '@contember/binding'\nimport type { FieldValue } from '@contember/binding'\n\nexport type ForceAccessorUpdate = () => void\n\n/**\n * It is VERY IMPORTANT for the parameter to be referentially stable!\n */\nfunction useAccessorUpdateSubscription<Value extends FieldValue = FieldValue>(\n\tgetFieldAccessor: () => FieldAccessor<Value>,\n): FieldAccessor<Value>\nfunction useAccessorUpdateSubscription(getEntityAccessor: () => EntityAccessor): EntityAccessor\nfunction useAccessorUpdateSubscription(getListAccessor: () => EntityListAccessor): EntityListAccessor\nfunction useAccessorUpdateSubscription(\n\tgetAccessor: () => EntityListAccessor | EntityAccessor,\n): EntityListAccessor | EntityAccessor\nfunction useAccessorUpdateSubscription<Value extends FieldValue = FieldValue>(\n\tgetFieldAccessor: () => FieldAccessor<Value>,\n\twithForceUpdate: true,\n): [FieldAccessor<Value>, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription(\n\tgetEntityAccessor: () => EntityAccessor,\n\twithForceUpdate: true,\n): [EntityAccessor, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription(\n\tgetListAccessor: () => EntityListAccessor,\n\twithForceUpdate: true,\n): [EntityListAccessor, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription(\n\tgetAccessor: () => EntityListAccessor | EntityAccessor,\n\twithForceUpdate: true,\n): [EntityListAccessor | EntityAccessor, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription<\n\tA extends FieldAccessor<Value> | EntityListAccessor | EntityAccessor,\n\tValue extends FieldValue = FieldValue,\n>(getAccessor: () => A, withForceUpdate?: true): A | [A, ForceAccessorUpdate] {\n\t// This is *HEAVILY* adopted from https://github.com/facebook/react/blob/master/packages/use-subscription/src/useSubscription.js\n\tconst [state, setState] = useState<{\n\t\taccessor: A\n\t\tgetAccessor: () => A\n\t}>(() => ({\n\t\t\t\taccessor: getAccessor(),\n\t\t\t\tgetAccessor,\n\t\t\t}))\n\n\tuseConstantValueInvariant(withForceUpdate, 'useAccessorUpdateSubscription: cannot change the withForceUpdate value!')\n\n\tlet accessor = state.accessor\n\n\tif (state.getAccessor !== getAccessor) {\n\t\tsetState({\n\t\t\taccessor: getAccessor(),\n\t\t\tgetAccessor,\n\t\t})\n\t\taccessor = getAccessor()\n\t}\n\n\tlet forceUpdate: ForceAccessorUpdate | undefined = undefined\n\tif (withForceUpdate) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tforceUpdate = useCallback(() => {\n\t\t\tsetState({\n\t\t\t\taccessor: getAccessor(),\n\t\t\t\tgetAccessor,\n\t\t\t})\n\t\t}, [getAccessor])\n\t}\n\n\tuseEffect(() => {\n\t\tlet isStillSubscribed = true\n\n\t\tconst unsubscribe = (\n\t\t\tgetAccessor().addEventListener as (\n\t\t\t\teventType: { type: 'update' },\n\t\t\t\thandler: (newAccessor: FieldAccessor<Value> | EntityListAccessor | EntityAccessor) => void,\n\t\t\t) => () => void\n\t\t)({ type: 'update' }, newAccessor => {\n\t\t\tif (!isStillSubscribed) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsetState(prevState => {\n\t\t\t\tif (prevState.getAccessor !== getAccessor || prevState.accessor === newAccessor) {\n\t\t\t\t\treturn prevState\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\taccessor: newAccessor as A,\n\t\t\t\t\tgetAccessor,\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\n\t\treturn () => {\n\t\t\tisStillSubscribed = false\n\t\t\tunsubscribe()\n\t\t}\n\t}, [getAccessor])\n\n\tif (withForceUpdate && forceUpdate) {\n\t\treturn [accessor, forceUpdate]\n\t}\n\treturn accessor\n}\nexport { useAccessorUpdateSubscription }\n"],"names":[],"mappings":";;AAkCA,SAAS,8BAGP,aAAsB,iBAAsD;AAE7E,QAAM,CAAC,OAAO,QAAQ,IAAI,SAGvB,OAAO;AAAA,IACP,UAAU,YAAY;AAAA,IACtB;AAAA,EACC,EAAA;AAEJ,4BAA0B,iBAAiB,yEAAyE;AAEpH,MAAI,WAAW,MAAM;AAEjB,MAAA,MAAM,gBAAgB,aAAa;AAC7B,aAAA;AAAA,MACR,UAAU,YAAY;AAAA,MACtB;AAAA,IAAA,CACA;AACD,eAAW,YAAY;AAAA,EACxB;AAEA,MAAI,cAA+C;AACnD,MAAI,iBAAiB;AAEpB,kBAAc,YAAY,MAAM;AACtB,eAAA;AAAA,QACR,UAAU,YAAY;AAAA,QACtB;AAAA,MAAA,CACA;AAAA,IAAA,GACC,CAAC,WAAW,CAAC;AAAA,EACjB;AAEA,YAAU,MAAM;AACf,QAAI,oBAAoB;AAElB,UAAA,cACL,cAAc,iBAIb,EAAE,MAAM,SAAA,GAAY,CAAe,gBAAA;AACpC,UAAI,CAAC,mBAAmB;AACvB;AAAA,MACD;AAEA,eAAS,CAAa,cAAA;AACrB,YAAI,UAAU,gBAAgB,eAAe,UAAU,aAAa,aAAa;AACzE,iBAAA;AAAA,QACR;AAEO,eAAA;AAAA,UACN,UAAU;AAAA,UACV;AAAA,QAAA;AAAA,MACD,CACA;AAAA,IAAA,CACD;AAED,WAAO,MAAM;AACQ,0BAAA;AACR;IAAA;AAAA,EACb,GACE,CAAC,WAAW,CAAC;AAEhB,MAAI,mBAAmB,aAAa;AAC5B,WAAA,CAAC,UAAU,WAAW;AAAA,EAC9B;AACO,SAAA;AACR;"}
1
+ {"version":3,"file":"useAccessorUpdateSubscription.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useAccessorUpdateSubscription.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\n\n/**\n * It is VERY IMPORTANT for the parameter to be referentially stable!\n */\nexport const useAccessorUpdateSubscription = <Accessor extends {\n\taddEventListener: (event: { type: 'update' }, cb: (accessor: Accessor) => void) => () => void\n}>(getAccessor: () => Accessor): [Accessor, {update: () => void}] => {\n\tconst [state, setState] = useState<Accessor>(() => getAccessor())\n\tconst getterRef = useRef(getAccessor)\n\n\tlet accessor = state\n\tif (getterRef.current !== getAccessor) {\n\t\taccessor = getAccessor()\n\t\tsetState(accessor)\n\t\tgetterRef.current = getAccessor\n\t}\n\n\tuseEffect(() => {\n\t\tlet isStillSubscribed = true\n\t\tconst unsubscribe = getAccessor().addEventListener({ type: 'update' }, newAccessor => {\n\t\t\tif (!isStillSubscribed || getterRef.current !== getAccessor) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetState(newAccessor)\n\t\t})\n\n\t\treturn () => {\n\t\t\tisStillSubscribed = false\n\t\t\tunsubscribe()\n\t\t}\n\t}, [getAccessor])\n\n\tconst update = useCallback(() => {\n\t\tsetState(getAccessor())\n\t}, [getAccessor])\n\n\treturn [accessor, { update }]\n}\n"],"names":[],"mappings":";AAKa,MAAA,gCAAgC,CAE1C,gBAAkE;AACpE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAmB,MAAM,aAAa;AAC1D,QAAA,YAAY,OAAO,WAAW;AAEpC,MAAI,WAAW;AACX,MAAA,UAAU,YAAY,aAAa;AACtC,eAAW,YAAY;AACvB,aAAS,QAAQ;AACjB,cAAU,UAAU;AAAA,EACrB;AAEA,YAAU,MAAM;AACf,QAAI,oBAAoB;AAClB,UAAA,cAAc,cAAc,iBAAiB,EAAE,MAAM,SAAA,GAAY,CAAe,gBAAA;AACrF,UAAI,CAAC,qBAAqB,UAAU,YAAY,aAAa;AAC5D;AAAA,MACD;AACA,eAAS,WAAW;AAAA,IAAA,CACpB;AAED,WAAO,MAAM;AACQ,0BAAA;AACR;IAAA;AAAA,EACb,GACE,CAAC,WAAW,CAAC;AAEV,QAAA,SAAS,YAAY,MAAM;AAChC,aAAS,aAAa;AAAA,EAAA,GACpB,CAAC,WAAW,CAAC;AAEhB,SAAO,CAAC,UAAU,EAAE,OAAA,CAAQ;AAC7B;"}
@@ -13,22 +13,22 @@ function useEntity(...entity) {
13
13
  const getEntityByKey = useGetEntityByKey.useGetEntityByKey();
14
14
  if (entity.length === 0) {
15
15
  const getEntityAccessor = React.useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey]);
16
- return useAccessorUpdateSubscription.useAccessorUpdateSubscription(getEntityAccessor);
16
+ return useAccessorUpdateSubscription.useAccessorUpdateSubscription(getEntityAccessor)[0];
17
17
  }
18
18
  const sugaredRelativeSingleEntity = entity[0];
19
19
  const relativeSingleEntity = useDesugaredRelativeSingleEntity.useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity);
20
20
  const getEntity = React.useCallback(() => {
21
21
  const parent = getEntityByKey(entityKey);
22
- return parent.getRelativeSingleEntity(relativeSingleEntity);
22
+ return parent.getEntity(relativeSingleEntity);
23
23
  }, [entityKey, getEntityByKey, relativeSingleEntity]);
24
24
  if (relativeSingleEntity) {
25
25
  reactUtils.useConstantLengthInvariant(
26
26
  relativeSingleEntity.hasOneRelationPath,
27
27
  "Cannot change the length of the hasOneRelation path!"
28
28
  );
29
- const [entity2, forceUpdate] = useAccessorUpdateSubscription.useAccessorUpdateSubscription(getEntity, true);
29
+ const [entity2, { update }] = useAccessorUpdateSubscription.useAccessorUpdateSubscription(getEntity);
30
30
  if (relativeSingleEntity.hasOneRelationPath.length) {
31
- useOnConnectionUpdate.useOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, forceUpdate);
31
+ useOnConnectionUpdate.useOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, update);
32
32
  }
33
33
  return entity2;
34
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useEntity.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntity.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeSingleEntity } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleEntity } from './useDesugaredRelativeSingleEntity'\n\nfunction useEntity(): EntityAccessor\nfunction useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): EntityAccessor\nfunction useEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): EntityAccessor | undefined\nfunction useEntity(...entity: [] | [string | SugaredRelativeSingleEntity | undefined]): EntityAccessor | undefined {\n\tuseConstantValueInvariant(entity.length, 'useEntity: cannot alternate between providing and omitting the argument.')\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\n\tif (entity.length === 0) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst getEntityAccessor = useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey])\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useAccessorUpdateSubscription(getEntityAccessor)\n\t}\n\tconst sugaredRelativeSingleEntity = entity[0]\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst relativeSingleEntity = useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity)\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst getEntity = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeSingleEntity(relativeSingleEntity!)\n\t}, [entityKey, getEntityByKey, relativeSingleEntity])\n\n\tif (relativeSingleEntity) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleEntity.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entity, forceUpdate] = useAccessorUpdateSubscription(getEntity, true)\n\n\t\tif (relativeSingleEntity.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn entity\n\t}\n\treturn undefined\n}\n\nexport { useEntity }\n"],"names":["useConstantValueInvariant","useEntityKey","useGetEntityByKey","useCallback","useAccessorUpdateSubscription","useDesugaredRelativeSingleEntity","useConstantLengthInvariant","entity","useOnConnectionUpdate"],"mappings":";;;;;;;;;AAcA,SAAS,aAAa,QAA6F;AACxFA,aAAAA,0BAAA,OAAO,QAAQ,0EAA0E;AAEnH,QAAM,YAAYC,aAAAA;AAClB,QAAM,iBAAiBC,kBAAAA;AAEnB,MAAA,OAAO,WAAW,GAAG;AAElB,UAAA,oBAAoBC,kBAAY,MAAM,eAAe,SAAS,GAAG,CAAC,WAAW,cAAc,CAAC;AAElG,WAAOC,8BAAAA,8BAA8B,iBAAiB;AAAA,EACvD;AACM,QAAA,8BAA8B,OAAO,CAAC;AAGtC,QAAA,uBAAuBC,kEAAiC,2BAA2B;AAEnF,QAAA,YAAYF,MAAAA,YAAY,MAAM;AAC7B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,wBAAwB,oBAAqB;AAAA,EACzD,GAAA,CAAC,WAAW,gBAAgB,oBAAoB,CAAC;AAEpD,MAAI,sBAAsB;AAEzBG,eAAA;AAAA,MACC,qBAAqB;AAAA,MACrB;AAAA,IAAA;AAGD,UAAM,CAACC,SAAQ,WAAW,IAAIH,8BAAAA,8BAA8B,WAAW,IAAI;AAEvE,QAAA,qBAAqB,mBAAmB,QAAQ;AAEnDI,4BAAA,sBAAsB,qBAAqB,mBAAmB,CAAC,EAAE,OAAO,WAAW;AAAA,IACpF;AAEOD,WAAAA;AAAAA,EACR;AACO,SAAA;AACR;;"}
1
+ {"version":3,"file":"useEntity.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntity.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeSingleEntity } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleEntity } from './useDesugaredRelativeSingleEntity'\n\nfunction useEntity(): EntityAccessor\nfunction useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): EntityAccessor\nfunction useEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): EntityAccessor | undefined\nfunction useEntity(...entity: [] | [string | SugaredRelativeSingleEntity | undefined]): EntityAccessor | undefined {\n\tuseConstantValueInvariant(entity.length, 'useEntity: cannot alternate between providing and omitting the argument.')\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\n\tif (entity.length === 0) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst getEntityAccessor = useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey])\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useAccessorUpdateSubscription(getEntityAccessor)[0]\n\t}\n\tconst sugaredRelativeSingleEntity = entity[0]\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst relativeSingleEntity = useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity)\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst getEntity = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getEntity(relativeSingleEntity!)\n\t}, [entityKey, getEntityByKey, relativeSingleEntity])\n\n\tif (relativeSingleEntity) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleEntity.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entity, { update }] = useAccessorUpdateSubscription(getEntity)\n\n\t\tif (relativeSingleEntity.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, update)\n\t\t}\n\n\t\treturn entity\n\t}\n\treturn undefined\n}\n\nexport { useEntity }\n"],"names":["useConstantValueInvariant","useEntityKey","useGetEntityByKey","useCallback","useAccessorUpdateSubscription","useDesugaredRelativeSingleEntity","useConstantLengthInvariant","entity","useOnConnectionUpdate"],"mappings":";;;;;;;;;AAcA,SAAS,aAAa,QAA6F;AACxFA,aAAAA,0BAAA,OAAO,QAAQ,0EAA0E;AAEnH,QAAM,YAAYC,aAAAA;AAClB,QAAM,iBAAiBC,kBAAAA;AAEnB,MAAA,OAAO,WAAW,GAAG;AAElB,UAAA,oBAAoBC,kBAAY,MAAM,eAAe,SAAS,GAAG,CAAC,WAAW,cAAc,CAAC;AAE3F,WAAAC,4DAA8B,iBAAiB,EAAE,CAAC;AAAA,EAC1D;AACM,QAAA,8BAA8B,OAAO,CAAC;AAGtC,QAAA,uBAAuBC,kEAAiC,2BAA2B;AAEnF,QAAA,YAAYF,MAAAA,YAAY,MAAM;AAC7B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,UAAU,oBAAqB;AAAA,EAC3C,GAAA,CAAC,WAAW,gBAAgB,oBAAoB,CAAC;AAEpD,MAAI,sBAAsB;AAEzBG,eAAA;AAAA,MACC,qBAAqB;AAAA,MACrB;AAAA,IAAA;AAGD,UAAM,CAACC,SAAQ,EAAE,OAAQ,CAAA,IAAIH,8BAAAA,8BAA8B,SAAS;AAEhE,QAAA,qBAAqB,mBAAmB,QAAQ;AAEnDI,4BAAA,sBAAsB,qBAAqB,mBAAmB,CAAC,EAAE,OAAO,MAAM;AAAA,IAC/E;AAEOD,WAAAA;AAAAA,EACR;AACO,SAAA;AACR;;"}
@@ -11,22 +11,22 @@ function useEntity(...entity) {
11
11
  const getEntityByKey = useGetEntityByKey();
12
12
  if (entity.length === 0) {
13
13
  const getEntityAccessor = useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey]);
14
- return useAccessorUpdateSubscription(getEntityAccessor);
14
+ return useAccessorUpdateSubscription(getEntityAccessor)[0];
15
15
  }
16
16
  const sugaredRelativeSingleEntity = entity[0];
17
17
  const relativeSingleEntity = useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity);
18
18
  const getEntity = useCallback(() => {
19
19
  const parent = getEntityByKey(entityKey);
20
- return parent.getRelativeSingleEntity(relativeSingleEntity);
20
+ return parent.getEntity(relativeSingleEntity);
21
21
  }, [entityKey, getEntityByKey, relativeSingleEntity]);
22
22
  if (relativeSingleEntity) {
23
23
  useConstantLengthInvariant(
24
24
  relativeSingleEntity.hasOneRelationPath,
25
25
  "Cannot change the length of the hasOneRelation path!"
26
26
  );
27
- const [entity2, forceUpdate] = useAccessorUpdateSubscription(getEntity, true);
27
+ const [entity2, { update }] = useAccessorUpdateSubscription(getEntity);
28
28
  if (relativeSingleEntity.hasOneRelationPath.length) {
29
- useOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, forceUpdate);
29
+ useOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, update);
30
30
  }
31
31
  return entity2;
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useEntity.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntity.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeSingleEntity } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleEntity } from './useDesugaredRelativeSingleEntity'\n\nfunction useEntity(): EntityAccessor\nfunction useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): EntityAccessor\nfunction useEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): EntityAccessor | undefined\nfunction useEntity(...entity: [] | [string | SugaredRelativeSingleEntity | undefined]): EntityAccessor | undefined {\n\tuseConstantValueInvariant(entity.length, 'useEntity: cannot alternate between providing and omitting the argument.')\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\n\tif (entity.length === 0) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst getEntityAccessor = useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey])\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useAccessorUpdateSubscription(getEntityAccessor)\n\t}\n\tconst sugaredRelativeSingleEntity = entity[0]\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst relativeSingleEntity = useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity)\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst getEntity = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeSingleEntity(relativeSingleEntity!)\n\t}, [entityKey, getEntityByKey, relativeSingleEntity])\n\n\tif (relativeSingleEntity) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleEntity.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entity, forceUpdate] = useAccessorUpdateSubscription(getEntity, true)\n\n\t\tif (relativeSingleEntity.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn entity\n\t}\n\treturn undefined\n}\n\nexport { useEntity }\n"],"names":["entity"],"mappings":";;;;;;;AAcA,SAAS,aAAa,QAA6F;AACxF,4BAAA,OAAO,QAAQ,0EAA0E;AAEnH,QAAM,YAAY;AAClB,QAAM,iBAAiB;AAEnB,MAAA,OAAO,WAAW,GAAG;AAElB,UAAA,oBAAoB,YAAY,MAAM,eAAe,SAAS,GAAG,CAAC,WAAW,cAAc,CAAC;AAElG,WAAO,8BAA8B,iBAAiB;AAAA,EACvD;AACM,QAAA,8BAA8B,OAAO,CAAC;AAGtC,QAAA,uBAAuB,iCAAiC,2BAA2B;AAEnF,QAAA,YAAY,YAAY,MAAM;AAC7B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,wBAAwB,oBAAqB;AAAA,EACzD,GAAA,CAAC,WAAW,gBAAgB,oBAAoB,CAAC;AAEpD,MAAI,sBAAsB;AAEzB;AAAA,MACC,qBAAqB;AAAA,MACrB;AAAA,IAAA;AAGD,UAAM,CAACA,SAAQ,WAAW,IAAI,8BAA8B,WAAW,IAAI;AAEvE,QAAA,qBAAqB,mBAAmB,QAAQ;AAEnD,4BAAsB,qBAAqB,mBAAmB,CAAC,EAAE,OAAO,WAAW;AAAA,IACpF;AAEOA,WAAAA;AAAAA,EACR;AACO,SAAA;AACR;"}
1
+ {"version":3,"file":"useEntity.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntity.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeSingleEntity } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleEntity } from './useDesugaredRelativeSingleEntity'\n\nfunction useEntity(): EntityAccessor\nfunction useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): EntityAccessor\nfunction useEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): EntityAccessor | undefined\nfunction useEntity(...entity: [] | [string | SugaredRelativeSingleEntity | undefined]): EntityAccessor | undefined {\n\tuseConstantValueInvariant(entity.length, 'useEntity: cannot alternate between providing and omitting the argument.')\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\n\tif (entity.length === 0) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst getEntityAccessor = useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey])\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useAccessorUpdateSubscription(getEntityAccessor)[0]\n\t}\n\tconst sugaredRelativeSingleEntity = entity[0]\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst relativeSingleEntity = useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity)\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst getEntity = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getEntity(relativeSingleEntity!)\n\t}, [entityKey, getEntityByKey, relativeSingleEntity])\n\n\tif (relativeSingleEntity) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleEntity.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entity, { update }] = useAccessorUpdateSubscription(getEntity)\n\n\t\tif (relativeSingleEntity.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, update)\n\t\t}\n\n\t\treturn entity\n\t}\n\treturn undefined\n}\n\nexport { useEntity }\n"],"names":["entity"],"mappings":";;;;;;;AAcA,SAAS,aAAa,QAA6F;AACxF,4BAAA,OAAO,QAAQ,0EAA0E;AAEnH,QAAM,YAAY;AAClB,QAAM,iBAAiB;AAEnB,MAAA,OAAO,WAAW,GAAG;AAElB,UAAA,oBAAoB,YAAY,MAAM,eAAe,SAAS,GAAG,CAAC,WAAW,cAAc,CAAC;AAE3F,WAAA,8BAA8B,iBAAiB,EAAE,CAAC;AAAA,EAC1D;AACM,QAAA,8BAA8B,OAAO,CAAC;AAGtC,QAAA,uBAAuB,iCAAiC,2BAA2B;AAEnF,QAAA,YAAY,YAAY,MAAM;AAC7B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,UAAU,oBAAqB;AAAA,EAC3C,GAAA,CAAC,WAAW,gBAAgB,oBAAoB,CAAC;AAEpD,MAAI,sBAAsB;AAEzB;AAAA,MACC,qBAAqB;AAAA,MACrB;AAAA,IAAA;AAGD,UAAM,CAACA,SAAQ,EAAE,OAAQ,CAAA,IAAI,8BAA8B,SAAS;AAEhE,QAAA,qBAAqB,mBAAmB,QAAQ;AAEnD,4BAAsB,qBAAqB,mBAAmB,CAAC,EAAE,OAAO,MAAM;AAAA,IAC/E;AAEOA,WAAAA;AAAAA,EACR;AACO,SAAA;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityKey.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityKey.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { BindingError } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useEntityKey = (): string => {\n\tconst entityKey = useContext(EntityKeyContext)\n\n\tif (entityKey === undefined) {\n\t\tthrow new BindingError(\n\t\t\t`Trying to use a data bound component outside a correct parent. You likely forgot to use <DataBindingProvider /> ` +\n\t\t\t\t`or a SubTree.`,\n\t\t)\n\t}\n\treturn entityKey\n}\n"],"names":["useContext","EntityKeyContext","BindingError"],"mappings":";;;;;AAIO,MAAM,eAAe,MAAc;AACnC,QAAA,YAAYA,iBAAWC,iBAAAA,gBAAgB;AAE7C,MAAI,cAAc,QAAW;AAC5B,UAAM,IAAIC,QAAA;AAAA,MACT;AAAA,IAAA;AAAA,EAGF;AACO,SAAA;AACR;;"}
1
+ {"version":3,"file":"useEntityKey.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityKey.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { BindingError, EntityAccessor } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useEntityKey = (): string | (() => EntityAccessor) => {\n\tconst entityKey = useContext(EntityKeyContext)\n\n\tif (entityKey === undefined) {\n\t\tthrow new BindingError(\n\t\t\t`Trying to use a data bound component outside a correct parent. You likely forgot to use <DataBindingProvider /> ` +\n\t\t\t\t`or a SubTree.`,\n\t\t)\n\t}\n\treturn entityKey\n}\n"],"names":["useContext","EntityKeyContext","BindingError"],"mappings":";;;;;AAIO,MAAM,eAAe,MAAuC;AAC5D,QAAA,YAAYA,iBAAWC,iBAAAA,gBAAgB;AAE7C,MAAI,cAAc,QAAW;AAC5B,UAAM,IAAIC,QAAA;AAAA,MACT;AAAA,IAAA;AAAA,EAGF;AACO,SAAA;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityKey.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityKey.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { BindingError } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useEntityKey = (): string => {\n\tconst entityKey = useContext(EntityKeyContext)\n\n\tif (entityKey === undefined) {\n\t\tthrow new BindingError(\n\t\t\t`Trying to use a data bound component outside a correct parent. You likely forgot to use <DataBindingProvider /> ` +\n\t\t\t\t`or a SubTree.`,\n\t\t)\n\t}\n\treturn entityKey\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,eAAe,MAAc;AACnC,QAAA,YAAY,WAAW,gBAAgB;AAE7C,MAAI,cAAc,QAAW;AAC5B,UAAM,IAAI;AAAA,MACT;AAAA,IAAA;AAAA,EAGF;AACO,SAAA;AACR;"}
1
+ {"version":3,"file":"useEntityKey.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityKey.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { BindingError, EntityAccessor } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useEntityKey = (): string | (() => EntityAccessor) => {\n\tconst entityKey = useContext(EntityKeyContext)\n\n\tif (entityKey === undefined) {\n\t\tthrow new BindingError(\n\t\t\t`Trying to use a data bound component outside a correct parent. You likely forgot to use <DataBindingProvider /> ` +\n\t\t\t\t`or a SubTree.`,\n\t\t)\n\t}\n\treturn entityKey\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,eAAe,MAAuC;AAC5D,QAAA,YAAY,WAAW,gBAAgB;AAE7C,MAAI,cAAc,QAAW;AAC5B,UAAM,IAAI;AAAA,MACT;AAAA,IAAA;AAAA,EAGF;AACO,SAAA;AACR;"}
@@ -17,16 +17,16 @@ function useEntityList(sugaredRelativeEntityList) {
17
17
  const getEntityByKey = useGetEntityByKey.useGetEntityByKey();
18
18
  const getEntityList = React.useCallback(() => {
19
19
  const parent = getEntityByKey(entityKey);
20
- return parent.getRelativeEntityList(relativeEntityList);
20
+ return parent.getEntityList(relativeEntityList);
21
21
  }, [entityKey, getEntityByKey, relativeEntityList]);
22
22
  if (relativeEntityList) {
23
23
  reactUtils.useConstantLengthInvariant(
24
24
  relativeEntityList.hasOneRelationPath,
25
25
  "Cannot change the length of the hasOneRelation path!"
26
26
  );
27
- const [entityList, forceUpdate] = useAccessorUpdateSubscription.useAccessorUpdateSubscription(getEntityList, true);
27
+ const [entityList, { update }] = useAccessorUpdateSubscription.useAccessorUpdateSubscription(getEntityList);
28
28
  if (relativeEntityList.hasOneRelationPath.length) {
29
- useOnConnectionUpdate.useOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, forceUpdate);
29
+ useOnConnectionUpdate.useOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, update);
30
30
  }
31
31
  return entityList;
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityList.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityList.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityListAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeEntityList } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeEntityList } from './useDesugaredRelativeEntityList'\n\nfunction useEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList): EntityListAccessor\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined {\n\tconst relativeEntityList = useDesugaredRelativeEntityList(sugaredRelativeEntityList)\n\tuseConstantValueInvariant(\n\t\t!!relativeEntityList,\n\t\t'useEntityList: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getEntityList = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeEntityList(relativeEntityList!)\n\t}, [entityKey, getEntityByKey, relativeEntityList])\n\n\tif (relativeEntityList) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeEntityList.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entityList, forceUpdate] = useAccessorUpdateSubscription(getEntityList, true)\n\n\t\tif (relativeEntityList.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn entityList\n\t}\n\treturn undefined\n}\n\nexport { useEntityList }\n"],"names":["useDesugaredRelativeEntityList","useConstantValueInvariant","useEntityKey","useGetEntityByKey","useCallback","useConstantLengthInvariant","useAccessorUpdateSubscription","useOnConnectionUpdate"],"mappings":";;;;;;;;;AAaA,SAAS,cACR,2BACiC;AAC3B,QAAA,qBAAqBA,8DAA+B,yBAAyB;AACnFC,aAAA;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,EAAA;AAGD,QAAM,YAAYC,aAAAA;AAClB,QAAM,iBAAiBC,kBAAAA;AACjB,QAAA,gBAAgBC,MAAAA,YAAY,MAAM;AACjC,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,sBAAsB,kBAAmB;AAAA,EACrD,GAAA,CAAC,WAAW,gBAAgB,kBAAkB,CAAC;AAElD,MAAI,oBAAoB;AAEvBC,eAAA;AAAA,MACC,mBAAmB;AAAA,MACnB;AAAA,IAAA;AAGD,UAAM,CAAC,YAAY,WAAW,IAAIC,8BAAAA,8BAA8B,eAAe,IAAI;AAE/E,QAAA,mBAAmB,mBAAmB,QAAQ;AAEjDC,4BAAA,sBAAsB,mBAAmB,mBAAmB,CAAC,EAAE,OAAO,WAAW;AAAA,IAClF;AAEO,WAAA;AAAA,EACR;AACO,SAAA;AACR;;"}
1
+ {"version":3,"file":"useEntityList.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityList.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityListAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeEntityList } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeEntityList } from './useDesugaredRelativeEntityList'\n\nfunction useEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList): EntityListAccessor\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined {\n\tconst relativeEntityList = useDesugaredRelativeEntityList(sugaredRelativeEntityList)\n\tuseConstantValueInvariant(\n\t\t!!relativeEntityList,\n\t\t'useEntityList: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getEntityList = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getEntityList(relativeEntityList!)\n\t}, [entityKey, getEntityByKey, relativeEntityList])\n\n\tif (relativeEntityList) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeEntityList.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entityList, { update }] = useAccessorUpdateSubscription(getEntityList)\n\n\t\tif (relativeEntityList.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, update)\n\t\t}\n\n\t\treturn entityList\n\t}\n\treturn undefined\n}\n\nexport { useEntityList }\n"],"names":["useDesugaredRelativeEntityList","useConstantValueInvariant","useEntityKey","useGetEntityByKey","useCallback","useConstantLengthInvariant","useAccessorUpdateSubscription","useOnConnectionUpdate"],"mappings":";;;;;;;;;AAaA,SAAS,cACR,2BACiC;AAC3B,QAAA,qBAAqBA,8DAA+B,yBAAyB;AACnFC,aAAA;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,EAAA;AAGD,QAAM,YAAYC,aAAAA;AAClB,QAAM,iBAAiBC,kBAAAA;AACjB,QAAA,gBAAgBC,MAAAA,YAAY,MAAM;AACjC,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,cAAc,kBAAmB;AAAA,EAC7C,GAAA,CAAC,WAAW,gBAAgB,kBAAkB,CAAC;AAElD,MAAI,oBAAoB;AAEvBC,eAAA;AAAA,MACC,mBAAmB;AAAA,MACnB;AAAA,IAAA;AAGD,UAAM,CAAC,YAAY,EAAE,OAAQ,CAAA,IAAIC,8BAAAA,8BAA8B,aAAa;AAExE,QAAA,mBAAmB,mBAAmB,QAAQ;AAEjDC,4BAAA,sBAAsB,mBAAmB,mBAAmB,CAAC,EAAE,OAAO,MAAM;AAAA,IAC7E;AAEO,WAAA;AAAA,EACR;AACO,SAAA;AACR;;"}
@@ -15,16 +15,16 @@ function useEntityList(sugaredRelativeEntityList) {
15
15
  const getEntityByKey = useGetEntityByKey();
16
16
  const getEntityList = useCallback(() => {
17
17
  const parent = getEntityByKey(entityKey);
18
- return parent.getRelativeEntityList(relativeEntityList);
18
+ return parent.getEntityList(relativeEntityList);
19
19
  }, [entityKey, getEntityByKey, relativeEntityList]);
20
20
  if (relativeEntityList) {
21
21
  useConstantLengthInvariant(
22
22
  relativeEntityList.hasOneRelationPath,
23
23
  "Cannot change the length of the hasOneRelation path!"
24
24
  );
25
- const [entityList, forceUpdate] = useAccessorUpdateSubscription(getEntityList, true);
25
+ const [entityList, { update }] = useAccessorUpdateSubscription(getEntityList);
26
26
  if (relativeEntityList.hasOneRelationPath.length) {
27
- useOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, forceUpdate);
27
+ useOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, update);
28
28
  }
29
29
  return entityList;
30
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityList.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityList.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityListAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeEntityList } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeEntityList } from './useDesugaredRelativeEntityList'\n\nfunction useEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList): EntityListAccessor\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined {\n\tconst relativeEntityList = useDesugaredRelativeEntityList(sugaredRelativeEntityList)\n\tuseConstantValueInvariant(\n\t\t!!relativeEntityList,\n\t\t'useEntityList: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getEntityList = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeEntityList(relativeEntityList!)\n\t}, [entityKey, getEntityByKey, relativeEntityList])\n\n\tif (relativeEntityList) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeEntityList.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entityList, forceUpdate] = useAccessorUpdateSubscription(getEntityList, true)\n\n\t\tif (relativeEntityList.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn entityList\n\t}\n\treturn undefined\n}\n\nexport { useEntityList }\n"],"names":[],"mappings":";;;;;;;AAaA,SAAS,cACR,2BACiC;AAC3B,QAAA,qBAAqB,+BAA+B,yBAAyB;AACnF;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,EAAA;AAGD,QAAM,YAAY;AAClB,QAAM,iBAAiB;AACjB,QAAA,gBAAgB,YAAY,MAAM;AACjC,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,sBAAsB,kBAAmB;AAAA,EACrD,GAAA,CAAC,WAAW,gBAAgB,kBAAkB,CAAC;AAElD,MAAI,oBAAoB;AAEvB;AAAA,MACC,mBAAmB;AAAA,MACnB;AAAA,IAAA;AAGD,UAAM,CAAC,YAAY,WAAW,IAAI,8BAA8B,eAAe,IAAI;AAE/E,QAAA,mBAAmB,mBAAmB,QAAQ;AAEjD,4BAAsB,mBAAmB,mBAAmB,CAAC,EAAE,OAAO,WAAW;AAAA,IAClF;AAEO,WAAA;AAAA,EACR;AACO,SAAA;AACR;"}
1
+ {"version":3,"file":"useEntityList.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityList.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityListAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeEntityList } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeEntityList } from './useDesugaredRelativeEntityList'\n\nfunction useEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList): EntityListAccessor\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined {\n\tconst relativeEntityList = useDesugaredRelativeEntityList(sugaredRelativeEntityList)\n\tuseConstantValueInvariant(\n\t\t!!relativeEntityList,\n\t\t'useEntityList: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getEntityList = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getEntityList(relativeEntityList!)\n\t}, [entityKey, getEntityByKey, relativeEntityList])\n\n\tif (relativeEntityList) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeEntityList.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entityList, { update }] = useAccessorUpdateSubscription(getEntityList)\n\n\t\tif (relativeEntityList.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, update)\n\t\t}\n\n\t\treturn entityList\n\t}\n\treturn undefined\n}\n\nexport { useEntityList }\n"],"names":[],"mappings":";;;;;;;AAaA,SAAS,cACR,2BACiC;AAC3B,QAAA,qBAAqB,+BAA+B,yBAAyB;AACnF;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,EAAA;AAGD,QAAM,YAAY;AAClB,QAAM,iBAAiB;AACjB,QAAA,gBAAgB,YAAY,MAAM;AACjC,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,cAAc,kBAAmB;AAAA,EAC7C,GAAA,CAAC,WAAW,gBAAgB,kBAAkB,CAAC;AAElD,MAAI,oBAAoB;AAEvB;AAAA,MACC,mBAAmB;AAAA,MACnB;AAAA,IAAA;AAGD,UAAM,CAAC,YAAY,EAAE,OAAQ,CAAA,IAAI,8BAA8B,aAAa;AAExE,QAAA,mBAAmB,mBAAmB,QAAQ;AAEjD,4BAAsB,mBAAmB,mBAAmB,CAAC,EAAE,OAAO,MAAM;AAAA,IAC7E;AAEO,WAAA;AAAA,EACR;AACO,SAAA;AACR;"}
@@ -13,7 +13,7 @@ const useEntityListSubTree = (qualifiedEntityList, ...treeId) => {
13
13
  () => getSubTree(parameters, ...hasTreeId ? [treeIdVal] : []),
14
14
  [getSubTree, hasTreeId, parameters, treeIdVal]
15
15
  );
16
- return useAccessorUpdateSubscription.useAccessorUpdateSubscription(getAccessor);
16
+ return useAccessorUpdateSubscription.useAccessorUpdateSubscription(getAccessor)[0];
17
17
  };
18
18
  exports.useEntityListSubTree = useEntityListSubTree;
19
19
  //# sourceMappingURL=useEntityListSubTree.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityListSubTree.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityListSubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\nimport type { Alias, SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useEntityListSubTreeParameters } from './useEntityListSubTreeParameters'\nimport { useGetEntityListSubTree } from './useGetEntityListSubTree'\nimport { TreeRootId } from '@contember/binding'\n\nexport const useEntityListSubTree = (\n\tqualifiedEntityList: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t...treeId: [TreeRootId | undefined] | []\n): EntityListAccessor => {\n\tconst getSubTree = useGetEntityListSubTree()\n\tconst parameters = useEntityListSubTreeParameters(qualifiedEntityList)\n\tconst hasTreeId = treeId.length > 0\n\tconst treeIdVal = treeId[0]\n\tconst getAccessor = useCallback(\n\t\t() => getSubTree(parameters, ...(hasTreeId ? [treeIdVal] : [])),\n\t\t[getSubTree, hasTreeId, parameters, treeIdVal],\n\t)\n\n\t// if (typeof parameters !== 'string' && parameters.value.hasOneRelationPath.length) {\n\t// \tthrow new BindingError(`useEntityListSubTree: cannot use hasOneRelationPath!`)\n\t// }\n\n\treturn useAccessorUpdateSubscription(getAccessor)\n}\n"],"names":["useGetEntityListSubTree","useEntityListSubTreeParameters","useCallback","useAccessorUpdateSubscription"],"mappings":";;;;;;AAQa,MAAA,uBAAuB,CACnC,wBACG,WACqB;AACxB,QAAM,aAAaA,wBAAAA;AACb,QAAA,aAAaC,8DAA+B,mBAAmB;AAC/D,QAAA,YAAY,OAAO,SAAS;AAC5B,QAAA,YAAY,OAAO,CAAC;AAC1B,QAAM,cAAcC,MAAA;AAAA,IACnB,MAAM,WAAW,YAAY,GAAI,YAAY,CAAC,SAAS,IAAI,EAAG;AAAA,IAC9D,CAAC,YAAY,WAAW,YAAY,SAAS;AAAA,EAAA;AAO9C,SAAOC,8BAAAA,8BAA8B,WAAW;AACjD;;"}
1
+ {"version":3,"file":"useEntityListSubTree.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityListSubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\nimport type { Alias, SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useEntityListSubTreeParameters } from './useEntityListSubTreeParameters'\nimport { useGetEntityListSubTree } from './useGetEntityListSubTree'\nimport { TreeRootId } from '@contember/binding'\n\nexport const useEntityListSubTree = (\n\tqualifiedEntityList: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t...treeId: [TreeRootId | undefined] | []\n): EntityListAccessor => {\n\tconst getSubTree = useGetEntityListSubTree()\n\tconst parameters = useEntityListSubTreeParameters(qualifiedEntityList)\n\tconst hasTreeId = treeId.length > 0\n\tconst treeIdVal = treeId[0]\n\tconst getAccessor = useCallback(\n\t\t() => getSubTree(parameters, ...(hasTreeId ? [treeIdVal] : [])),\n\t\t[getSubTree, hasTreeId, parameters, treeIdVal],\n\t)\n\n\t// if (typeof parameters !== 'string' && parameters.value.hasOneRelationPath.length) {\n\t// \tthrow new BindingError(`useEntityListSubTree: cannot use hasOneRelationPath!`)\n\t// }\n\n\treturn useAccessorUpdateSubscription(getAccessor)[0]\n}\n"],"names":["useGetEntityListSubTree","useEntityListSubTreeParameters","useCallback","useAccessorUpdateSubscription"],"mappings":";;;;;;AAQa,MAAA,uBAAuB,CACnC,wBACG,WACqB;AACxB,QAAM,aAAaA,wBAAAA;AACb,QAAA,aAAaC,8DAA+B,mBAAmB;AAC/D,QAAA,YAAY,OAAO,SAAS;AAC5B,QAAA,YAAY,OAAO,CAAC;AAC1B,QAAM,cAAcC,MAAA;AAAA,IACnB,MAAM,WAAW,YAAY,GAAI,YAAY,CAAC,SAAS,IAAI,EAAG;AAAA,IAC9D,CAAC,YAAY,WAAW,YAAY,SAAS;AAAA,EAAA;AAOvC,SAAAC,4DAA8B,WAAW,EAAE,CAAC;AACpD;;"}
@@ -11,7 +11,7 @@ const useEntityListSubTree = (qualifiedEntityList, ...treeId) => {
11
11
  () => getSubTree(parameters, ...hasTreeId ? [treeIdVal] : []),
12
12
  [getSubTree, hasTreeId, parameters, treeIdVal]
13
13
  );
14
- return useAccessorUpdateSubscription(getAccessor);
14
+ return useAccessorUpdateSubscription(getAccessor)[0];
15
15
  };
16
16
  export {
17
17
  useEntityListSubTree
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityListSubTree.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityListSubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\nimport type { Alias, SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useEntityListSubTreeParameters } from './useEntityListSubTreeParameters'\nimport { useGetEntityListSubTree } from './useGetEntityListSubTree'\nimport { TreeRootId } from '@contember/binding'\n\nexport const useEntityListSubTree = (\n\tqualifiedEntityList: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t...treeId: [TreeRootId | undefined] | []\n): EntityListAccessor => {\n\tconst getSubTree = useGetEntityListSubTree()\n\tconst parameters = useEntityListSubTreeParameters(qualifiedEntityList)\n\tconst hasTreeId = treeId.length > 0\n\tconst treeIdVal = treeId[0]\n\tconst getAccessor = useCallback(\n\t\t() => getSubTree(parameters, ...(hasTreeId ? [treeIdVal] : [])),\n\t\t[getSubTree, hasTreeId, parameters, treeIdVal],\n\t)\n\n\t// if (typeof parameters !== 'string' && parameters.value.hasOneRelationPath.length) {\n\t// \tthrow new BindingError(`useEntityListSubTree: cannot use hasOneRelationPath!`)\n\t// }\n\n\treturn useAccessorUpdateSubscription(getAccessor)\n}\n"],"names":[],"mappings":";;;;AAQa,MAAA,uBAAuB,CACnC,wBACG,WACqB;AACxB,QAAM,aAAa;AACb,QAAA,aAAa,+BAA+B,mBAAmB;AAC/D,QAAA,YAAY,OAAO,SAAS;AAC5B,QAAA,YAAY,OAAO,CAAC;AAC1B,QAAM,cAAc;AAAA,IACnB,MAAM,WAAW,YAAY,GAAI,YAAY,CAAC,SAAS,IAAI,EAAG;AAAA,IAC9D,CAAC,YAAY,WAAW,YAAY,SAAS;AAAA,EAAA;AAO9C,SAAO,8BAA8B,WAAW;AACjD;"}
1
+ {"version":3,"file":"useEntityListSubTree.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityListSubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\nimport type { Alias, SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useEntityListSubTreeParameters } from './useEntityListSubTreeParameters'\nimport { useGetEntityListSubTree } from './useGetEntityListSubTree'\nimport { TreeRootId } from '@contember/binding'\n\nexport const useEntityListSubTree = (\n\tqualifiedEntityList: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t...treeId: [TreeRootId | undefined] | []\n): EntityListAccessor => {\n\tconst getSubTree = useGetEntityListSubTree()\n\tconst parameters = useEntityListSubTreeParameters(qualifiedEntityList)\n\tconst hasTreeId = treeId.length > 0\n\tconst treeIdVal = treeId[0]\n\tconst getAccessor = useCallback(\n\t\t() => getSubTree(parameters, ...(hasTreeId ? [treeIdVal] : [])),\n\t\t[getSubTree, hasTreeId, parameters, treeIdVal],\n\t)\n\n\t// if (typeof parameters !== 'string' && parameters.value.hasOneRelationPath.length) {\n\t// \tthrow new BindingError(`useEntityListSubTree: cannot use hasOneRelationPath!`)\n\t// }\n\n\treturn useAccessorUpdateSubscription(getAccessor)[0]\n}\n"],"names":[],"mappings":";;;;AAQa,MAAA,uBAAuB,CACnC,wBACG,WACqB;AACxB,QAAM,aAAa;AACb,QAAA,aAAa,+BAA+B,mBAAmB;AAC/D,QAAA,YAAY,OAAO,SAAS;AAC5B,QAAA,YAAY,OAAO,CAAC;AAC1B,QAAM,cAAc;AAAA,IACnB,MAAM,WAAW,YAAY,GAAI,YAAY,CAAC,SAAS,IAAI,EAAG;AAAA,IAC9D,CAAC,YAAY,WAAW,YAAY,SAAS;AAAA,EAAA;AAOvC,SAAA,8BAA8B,WAAW,EAAE,CAAC;AACpD;"}
@@ -13,7 +13,7 @@ const useEntitySubTree = (qualifiedSingleEntity, ...treeId) => {
13
13
  () => getSubTree(parameters, ...hasTreeId ? [treeIdVal] : []),
14
14
  [getSubTree, hasTreeId, parameters, treeIdVal]
15
15
  );
16
- return useAccessorUpdateSubscription.useAccessorUpdateSubscription(getAccessor);
16
+ return useAccessorUpdateSubscription.useAccessorUpdateSubscription(getAccessor)[0];
17
17
  };
18
18
  exports.useEntitySubTree = useEntitySubTree;
19
19
  //# sourceMappingURL=useEntitySubTree.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEntitySubTree.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport type { Alias, SugaredQualifiedSingleEntity, SugaredUnconstrainedQualifiedSingleEntity } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useEntitySubTreeParameters } from './useEntitySubTreeParameters'\nimport { useGetEntitySubTree } from './useGetEntitySubTree'\nimport { TreeRootId } from '@contember/binding'\n\nexport const useEntitySubTree = (\n\tqualifiedSingleEntity: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n): EntityAccessor => {\n\tconst getSubTree = useGetEntitySubTree()\n\tconst parameters = useEntitySubTreeParameters(qualifiedSingleEntity)\n\tconst hasTreeId = treeId.length > 0\n\tconst treeIdVal = treeId[0]\n\tconst getAccessor = useCallback(\n\t\t() => getSubTree(parameters, ...(hasTreeId ? [treeIdVal] : [])),\n\t\t[getSubTree, hasTreeId, parameters, treeIdVal],\n\t)\n\n\t// if (typeof parameters !== 'string' && parameters.hasOneRelationPath.length) {\n\t// \tthrow new BindingError(`useEntitySubTree: cannot use hasOneRelationPath!`)\n\t// }\n\treturn useAccessorUpdateSubscription(getAccessor)\n}\n"],"names":["useGetEntitySubTree","useEntitySubTreeParameters","useCallback","useAccessorUpdateSubscription"],"mappings":";;;;;;AAQa,MAAA,mBAAmB,CAC/B,0BACG,WACiB;AACpB,QAAM,aAAaA,oBAAAA;AACb,QAAA,aAAaC,sDAA2B,qBAAqB;AAC7D,QAAA,YAAY,OAAO,SAAS;AAC5B,QAAA,YAAY,OAAO,CAAC;AAC1B,QAAM,cAAcC,MAAA;AAAA,IACnB,MAAM,WAAW,YAAY,GAAI,YAAY,CAAC,SAAS,IAAI,EAAG;AAAA,IAC9D,CAAC,YAAY,WAAW,YAAY,SAAS;AAAA,EAAA;AAM9C,SAAOC,8BAAAA,8BAA8B,WAAW;AACjD;;"}
1
+ {"version":3,"file":"useEntitySubTree.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { Alias, EntityAccessor, SugaredQualifiedSingleEntity, SugaredUnconstrainedQualifiedSingleEntity } from '@contember/binding'\nimport { TreeRootId } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useEntitySubTreeParameters } from './useEntitySubTreeParameters'\nimport { useGetEntitySubTree } from './useGetEntitySubTree'\n\nexport const useEntitySubTree = (\n\tqualifiedSingleEntity: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n): EntityAccessor => {\n\tconst getSubTree = useGetEntitySubTree()\n\tconst parameters = useEntitySubTreeParameters(qualifiedSingleEntity)\n\tconst hasTreeId = treeId.length > 0\n\tconst treeIdVal = treeId[0]\n\tconst getAccessor = useCallback(\n\t\t() => getSubTree(parameters, ...(hasTreeId ? [treeIdVal] : [])),\n\t\t[getSubTree, hasTreeId, parameters, treeIdVal],\n\t)\n\n\t// if (typeof parameters !== 'string' && parameters.hasOneRelationPath.length) {\n\t// \tthrow new BindingError(`useEntitySubTree: cannot use hasOneRelationPath!`)\n\t// }\n\treturn useAccessorUpdateSubscription(getAccessor)[0]\n}\n"],"names":["useGetEntitySubTree","useEntitySubTreeParameters","useCallback","useAccessorUpdateSubscription"],"mappings":";;;;;;AAOa,MAAA,mBAAmB,CAC/B,0BACG,WACiB;AACpB,QAAM,aAAaA,oBAAAA;AACb,QAAA,aAAaC,sDAA2B,qBAAqB;AAC7D,QAAA,YAAY,OAAO,SAAS;AAC5B,QAAA,YAAY,OAAO,CAAC;AAC1B,QAAM,cAAcC,MAAA;AAAA,IACnB,MAAM,WAAW,YAAY,GAAI,YAAY,CAAC,SAAS,IAAI,EAAG;AAAA,IAC9D,CAAC,YAAY,WAAW,YAAY,SAAS;AAAA,EAAA;AAMvC,SAAAC,4DAA8B,WAAW,EAAE,CAAC;AACpD;;"}
@@ -11,7 +11,7 @@ const useEntitySubTree = (qualifiedSingleEntity, ...treeId) => {
11
11
  () => getSubTree(parameters, ...hasTreeId ? [treeIdVal] : []),
12
12
  [getSubTree, hasTreeId, parameters, treeIdVal]
13
13
  );
14
- return useAccessorUpdateSubscription(getAccessor);
14
+ return useAccessorUpdateSubscription(getAccessor)[0];
15
15
  };
16
16
  export {
17
17
  useEntitySubTree
@@ -1 +1 @@
1
- {"version":3,"file":"useEntitySubTree.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport type { Alias, SugaredQualifiedSingleEntity, SugaredUnconstrainedQualifiedSingleEntity } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useEntitySubTreeParameters } from './useEntitySubTreeParameters'\nimport { useGetEntitySubTree } from './useGetEntitySubTree'\nimport { TreeRootId } from '@contember/binding'\n\nexport const useEntitySubTree = (\n\tqualifiedSingleEntity: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n): EntityAccessor => {\n\tconst getSubTree = useGetEntitySubTree()\n\tconst parameters = useEntitySubTreeParameters(qualifiedSingleEntity)\n\tconst hasTreeId = treeId.length > 0\n\tconst treeIdVal = treeId[0]\n\tconst getAccessor = useCallback(\n\t\t() => getSubTree(parameters, ...(hasTreeId ? [treeIdVal] : [])),\n\t\t[getSubTree, hasTreeId, parameters, treeIdVal],\n\t)\n\n\t// if (typeof parameters !== 'string' && parameters.hasOneRelationPath.length) {\n\t// \tthrow new BindingError(`useEntitySubTree: cannot use hasOneRelationPath!`)\n\t// }\n\treturn useAccessorUpdateSubscription(getAccessor)\n}\n"],"names":[],"mappings":";;;;AAQa,MAAA,mBAAmB,CAC/B,0BACG,WACiB;AACpB,QAAM,aAAa;AACb,QAAA,aAAa,2BAA2B,qBAAqB;AAC7D,QAAA,YAAY,OAAO,SAAS;AAC5B,QAAA,YAAY,OAAO,CAAC;AAC1B,QAAM,cAAc;AAAA,IACnB,MAAM,WAAW,YAAY,GAAI,YAAY,CAAC,SAAS,IAAI,EAAG;AAAA,IAC9D,CAAC,YAAY,WAAW,YAAY,SAAS;AAAA,EAAA;AAM9C,SAAO,8BAA8B,WAAW;AACjD;"}
1
+ {"version":3,"file":"useEntitySubTree.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { Alias, EntityAccessor, SugaredQualifiedSingleEntity, SugaredUnconstrainedQualifiedSingleEntity } from '@contember/binding'\nimport { TreeRootId } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useEntitySubTreeParameters } from './useEntitySubTreeParameters'\nimport { useGetEntitySubTree } from './useGetEntitySubTree'\n\nexport const useEntitySubTree = (\n\tqualifiedSingleEntity: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n): EntityAccessor => {\n\tconst getSubTree = useGetEntitySubTree()\n\tconst parameters = useEntitySubTreeParameters(qualifiedSingleEntity)\n\tconst hasTreeId = treeId.length > 0\n\tconst treeIdVal = treeId[0]\n\tconst getAccessor = useCallback(\n\t\t() => getSubTree(parameters, ...(hasTreeId ? [treeIdVal] : [])),\n\t\t[getSubTree, hasTreeId, parameters, treeIdVal],\n\t)\n\n\t// if (typeof parameters !== 'string' && parameters.hasOneRelationPath.length) {\n\t// \tthrow new BindingError(`useEntitySubTree: cannot use hasOneRelationPath!`)\n\t// }\n\treturn useAccessorUpdateSubscription(getAccessor)[0]\n}\n"],"names":[],"mappings":";;;;AAOa,MAAA,mBAAmB,CAC/B,0BACG,WACiB;AACpB,QAAM,aAAa;AACb,QAAA,aAAa,2BAA2B,qBAAqB;AAC7D,QAAA,YAAY,OAAO,SAAS;AAC5B,QAAA,YAAY,OAAO,CAAC;AAC1B,QAAM,cAAc;AAAA,IACnB,MAAM,WAAW,YAAY,GAAI,YAAY,CAAC,SAAS,IAAI,EAAG;AAAA,IAC9D,CAAC,YAAY,WAAW,YAAY,SAAS;AAAA,EAAA;AAMvC,SAAA,8BAA8B,WAAW,EAAE,CAAC;AACpD;"}
@@ -17,16 +17,16 @@ function useField(sugaredRelativeSingleField) {
17
17
  const getEntityByKey = useGetEntityByKey.useGetEntityByKey();
18
18
  const getField = React.useCallback(() => {
19
19
  const parent = getEntityByKey(entityKey);
20
- return parent.getRelativeSingleField(relativeSingleField);
20
+ return parent.getField(relativeSingleField);
21
21
  }, [entityKey, getEntityByKey, relativeSingleField]);
22
22
  if (relativeSingleField) {
23
23
  reactUtils.useConstantLengthInvariant(
24
24
  relativeSingleField.hasOneRelationPath,
25
25
  "Cannot change the length of the hasOneRelation path!"
26
26
  );
27
- const [field, forceUpdate] = useAccessorUpdateSubscription.useAccessorUpdateSubscription(getField, true);
27
+ const [field, { update }] = useAccessorUpdateSubscription.useAccessorUpdateSubscription(getField);
28
28
  if (relativeSingleField.hasOneRelationPath.length) {
29
- useOnConnectionUpdate.useOnConnectionUpdate(relativeSingleField.hasOneRelationPath[0].field, forceUpdate);
29
+ useOnConnectionUpdate.useOnConnectionUpdate(relativeSingleField.hasOneRelationPath[0].field, update);
30
30
  }
31
31
  return field;
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useField.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useField.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { FieldAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { FieldValue, SugaredRelativeSingleField } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleField } from './useDesugaredRelativeSingleField'\n\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField,\n): FieldAccessor<Value>\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined {\n\tconst relativeSingleField = useDesugaredRelativeSingleField(sugaredRelativeSingleField)\n\tuseConstantValueInvariant(\n\t\t!!relativeSingleField,\n\t\t'useField: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getField = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeSingleField<Value>(relativeSingleField!)\n\t}, [entityKey, getEntityByKey, relativeSingleField])\n\n\tif (relativeSingleField) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleField.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [field, forceUpdate] = useAccessorUpdateSubscription<Value>(getField, true)\n\n\t\tif (relativeSingleField.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleField.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn field\n\t}\n\treturn undefined\n}\n\nexport { useField }\n"],"names":["useDesugaredRelativeSingleField","useConstantValueInvariant","useEntityKey","useGetEntityByKey","useCallback","useConstantLengthInvariant","useAccessorUpdateSubscription","useOnConnectionUpdate"],"mappings":";;;;;;;;;AAeA,SAAS,SACR,4BACmC;AAC7B,QAAA,sBAAsBA,gEAAgC,0BAA0B;AACtFC,aAAA;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,EAAA;AAGD,QAAM,YAAYC,aAAAA;AAClB,QAAM,iBAAiBC,kBAAAA;AACjB,QAAA,WAAWC,MAAAA,YAAY,MAAM;AAC5B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,uBAA8B,mBAAoB;AAAA,EAC9D,GAAA,CAAC,WAAW,gBAAgB,mBAAmB,CAAC;AAEnD,MAAI,qBAAqB;AAExBC,eAAA;AAAA,MACC,oBAAoB;AAAA,MACpB;AAAA,IAAA;AAGD,UAAM,CAAC,OAAO,WAAW,IAAIC,8BAAAA,8BAAqC,UAAU,IAAI;AAE5E,QAAA,oBAAoB,mBAAmB,QAAQ;AAElDC,4BAAA,sBAAsB,oBAAoB,mBAAmB,CAAC,EAAE,OAAO,WAAW;AAAA,IACnF;AAEO,WAAA;AAAA,EACR;AACO,SAAA;AACR;;"}
1
+ {"version":3,"file":"useField.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useField.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { FieldAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { FieldValue, SugaredRelativeSingleField } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleField } from './useDesugaredRelativeSingleField'\n\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField,\n): FieldAccessor<Value>\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined {\n\tconst relativeSingleField = useDesugaredRelativeSingleField(sugaredRelativeSingleField)\n\tuseConstantValueInvariant(\n\t\t!!relativeSingleField,\n\t\t'useField: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getField = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getField<Value>(relativeSingleField!)\n\t}, [entityKey, getEntityByKey, relativeSingleField])\n\n\tif (relativeSingleField) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleField.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [field, { update }] = useAccessorUpdateSubscription(getField)\n\n\t\tif (relativeSingleField.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleField.hasOneRelationPath[0].field, update)\n\t\t}\n\n\t\treturn field\n\t}\n\treturn undefined\n}\n\nexport { useField }\n"],"names":["useDesugaredRelativeSingleField","useConstantValueInvariant","useEntityKey","useGetEntityByKey","useCallback","useConstantLengthInvariant","useAccessorUpdateSubscription","useOnConnectionUpdate"],"mappings":";;;;;;;;;AAeA,SAAS,SACR,4BACmC;AAC7B,QAAA,sBAAsBA,gEAAgC,0BAA0B;AACtFC,aAAA;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,EAAA;AAGD,QAAM,YAAYC,aAAAA;AAClB,QAAM,iBAAiBC,kBAAAA;AACjB,QAAA,WAAWC,MAAAA,YAAY,MAAM;AAC5B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,SAAgB,mBAAoB;AAAA,EAChD,GAAA,CAAC,WAAW,gBAAgB,mBAAmB,CAAC;AAEnD,MAAI,qBAAqB;AAExBC,eAAA;AAAA,MACC,oBAAoB;AAAA,MACpB;AAAA,IAAA;AAGD,UAAM,CAAC,OAAO,EAAE,OAAQ,CAAA,IAAIC,8BAAAA,8BAA8B,QAAQ;AAE9D,QAAA,oBAAoB,mBAAmB,QAAQ;AAElDC,4BAAA,sBAAsB,oBAAoB,mBAAmB,CAAC,EAAE,OAAO,MAAM;AAAA,IAC9E;AAEO,WAAA;AAAA,EACR;AACO,SAAA;AACR;;"}
@@ -15,16 +15,16 @@ function useField(sugaredRelativeSingleField) {
15
15
  const getEntityByKey = useGetEntityByKey();
16
16
  const getField = useCallback(() => {
17
17
  const parent = getEntityByKey(entityKey);
18
- return parent.getRelativeSingleField(relativeSingleField);
18
+ return parent.getField(relativeSingleField);
19
19
  }, [entityKey, getEntityByKey, relativeSingleField]);
20
20
  if (relativeSingleField) {
21
21
  useConstantLengthInvariant(
22
22
  relativeSingleField.hasOneRelationPath,
23
23
  "Cannot change the length of the hasOneRelation path!"
24
24
  );
25
- const [field, forceUpdate] = useAccessorUpdateSubscription(getField, true);
25
+ const [field, { update }] = useAccessorUpdateSubscription(getField);
26
26
  if (relativeSingleField.hasOneRelationPath.length) {
27
- useOnConnectionUpdate(relativeSingleField.hasOneRelationPath[0].field, forceUpdate);
27
+ useOnConnectionUpdate(relativeSingleField.hasOneRelationPath[0].field, update);
28
28
  }
29
29
  return field;
30
30
  }