@onehat/ui 0.3.307 → 0.3.308

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/ui",
3
- "version": "0.3.307",
3
+ "version": "0.3.308",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -111,6 +111,15 @@ export default function withSecondaryEditor(WrappedComponent, isTree = false) {
111
111
  secondaryDoAdd = async (e, values) => {
112
112
  let addValues = values;
113
113
 
114
+ if (SecondaryRepository?.isLoading) {
115
+ // NOTE: This is a hack to prevent adding a new record while the repository is still loading.
116
+ // This can happen when the repository is still loading, and the user clicks the 'Add' button.
117
+ setTimeout(() => {
118
+ doAdd(e, values);
119
+ }, 500);
120
+ return;
121
+ }
122
+
114
123
  if (!values) {
115
124
  // you can either:
116
125
  // 1. directlty submit 'values' to use in secondaryDoAdd(), or
@@ -110,6 +110,15 @@ export default function withEditor(WrappedComponent, isTree = false) {
110
110
  doAdd = async (e, values) => {
111
111
  let addValues = values;
112
112
 
113
+ if (Repository?.isLoading) {
114
+ // NOTE: This is a hack to prevent adding a new record while the repository is still loading.
115
+ // This can happen when the repository is still loading, and the user clicks the 'Add' button.
116
+ setTimeout(() => {
117
+ doAdd(e, values);
118
+ }, 500);
119
+ return;
120
+ }
121
+
113
122
  if (!values) {
114
123
  // you can either:
115
124
  // 1. directlty submit 'values' to use in doAdd(), or