@onehat/ui 0.3.306 → 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.306",
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
@@ -622,7 +622,7 @@ export function runClosureTreeControlledManagerScreenCrudTests(model, schema, ne
622
622
 
623
623
  const
624
624
  Models = Inflector.camelize(Inflector.pluralize(model)),
625
- url = '/' + Inflector.dasherize(Inflector.underscore(Models));
625
+ url = Inflector.dasherize(Inflector.underscore(Models));
626
626
 
627
627
  describe(Models + 'Manager', () => {
628
628
 
@@ -711,7 +711,7 @@ export function runClosureTreeManagerScreenCrudTests(model, schema, newData, edi
711
711
 
712
712
  const
713
713
  Models = fixInflector(Inflector.camelize(Inflector.pluralize(model))),
714
- url = '/' + fixInflector(Inflector.dasherize(Inflector.underscore(Models)));
714
+ url = fixInflector(Inflector.dasherize(Inflector.underscore(Models)));
715
715
 
716
716
  describe(Models + 'Manager', () => {
717
717
 
@@ -763,7 +763,7 @@ export function runInlineManagerScreenCrudTests(model, schema, newData, editData
763
763
 
764
764
  const
765
765
  Models = fixInflector(Inflector.camelize(Inflector.pluralize(model))),
766
- url = '/' + fixInflector(Inflector.dasherize(Inflector.underscore(Models)));
766
+ url = fixInflector(Inflector.dasherize(Inflector.underscore(Models)));
767
767
 
768
768
  describe(Models + 'Manager', () => {
769
769
 
@@ -815,7 +815,7 @@ export function runManagerScreenCrudTests(model, schema, newData, editData, anci
815
815
 
816
816
  const
817
817
  Models = fixInflector(Inflector.camelize(Inflector.pluralize(model))),
818
- url = '/' + fixInflector(Inflector.dasherize(Inflector.underscore(Models)));
818
+ url = fixInflector(Inflector.dasherize(Inflector.underscore(Models)));
819
819
 
820
820
  describe(Models + 'Manager', () => {
821
821
 
@@ -865,7 +865,7 @@ export function runManagerScreenCrudTests(model, schema, newData, editData, anci
865
865
  }
866
866
  export function runReportsManagerTests(reportData) {
867
867
 
868
- const url = '/reports';
868
+ const url = 'reports';
869
869
 
870
870
  describe('ReportsManager', () => {
871
871
 
@@ -49,7 +49,8 @@ export function logout() {
49
49
  export function navigateViaTabOrHomeButtonTo(url) {
50
50
  // i.e. If we're on home screen, press the button.
51
51
  // If we have a tab navigation, press the tab's button
52
- getDomNode(url).click(); // i.e. the DomNode's data-testid is the url
52
+ const baseDir = Cypress.env('baseDir');
53
+ getDomNode(baseDir + url).click(); // i.e. the DomNode's data-testid is the url
53
54
  cy.url().should('include', url);
54
55
  }
55
56
  export function navigateToHome() {