@kaspernj/api-maker 1.0.289 → 1.0.290

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
@@ -16,7 +16,7 @@
16
16
  ]
17
17
  },
18
18
  "name": "@kaspernj/api-maker",
19
- "version": "1.0.289",
19
+ "version": "1.0.290",
20
20
  "type": "module",
21
21
  "description": "",
22
22
  "main": "index.js",
@@ -185,6 +185,13 @@ class ApiMakerTable extends React.PureComponent {
185
185
  "showNoRecordsFoundContent"
186
186
  )
187
187
 
188
+ if (collection && collection.args.modelClass != modelClass) {
189
+ throw new Error(
190
+ `Model class from collection '${collection.args.modelClass.modelClassData().name}' ` +
191
+ `didn't match model class on table: '${modelClass.modelClassData().name}'`
192
+ )
193
+ }
194
+
188
195
  return (
189
196
  <div className={this.className()}>
190
197
  {preload !== undefined &&
@@ -365,6 +372,7 @@ class ApiMakerTable extends React.PureComponent {
365
372
  <input
366
373
  className="btn btn-primary live-table--submit-filter-button"
367
374
  type="submit"
375
+ style={{marginTop: "8px"}}
368
376
  value={filterSubmitLabel || I18n.t("js.api_maker_bootstrap.live_table.filter")}
369
377
  />
370
378
  }
@@ -1,5 +1,6 @@
1
1
  import Collection from "../collection.mjs"
2
2
  import EventConnection from "../event-connection"
3
+ import PropTypesExact from "prop-types-exact"
3
4
  import {simpleObjectDifferent} from "set-state-compare/src/diff-utils"
4
5
  import {useEffect, useRef} from "react"
5
6
 
@@ -1,5 +1,6 @@
1
1
  import EventConnection from "../event-connection"
2
2
  import modelClassRequire from "../model-class-require.mjs"
3
+ import PropTypesExact from "prop-types-exact"
3
4
 
4
5
  const Workplace = modelClassRequire("Workplace")
5
6
 
@@ -76,7 +76,7 @@ export default (WrappedComponent, modelClassArg, argsArg = {}) => {
76
76
  const ModelClass = digg(this, "modelClass")
77
77
  const query = await ModelClass.ransack({id_eq: modelId})
78
78
 
79
- if (!modelId) throw new Error(`No model ID was given: ${modelId}`)
79
+ if (!modelId) throw new Error(`No model ID was given: ${modelId} by '${this.paramsVariableName}' in query params: ${Object.keys(this.props.match.params).join(", ")}`)
80
80
  if (this.args.abilities) query.abilities(this.args.abilities)
81
81
  if (this.args.preload) query.preload(this.args.preload)
82
82
  if (this.args.select) query.select(this.args.select)