@kaspernj/api-maker 1.0.383 → 1.0.384
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 +1 -1
- package/src/table/use-breakpoint.mjs +2 -2
- package/src/use-can-can.mjs +2 -2
- package/src/use-collection.mjs +2 -2
- package/src/use-created-event.mjs +2 -2
- package/src/use-destroyed-event.mjs +2 -2
- package/src/use-event-emitter.mjs +2 -2
- package/src/use-event-listener.mjs +2 -2
- package/src/use-model.mjs +5 -5
- package/src/use-resize-observer.mjs +2 -2
- package/src/use-updated-event.mjs +2 -2
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useCallback,
|
|
1
|
+
import {useCallback, useLayoutEffect} from "react"
|
|
2
2
|
import apiMakerConfig from "@kaspernj/api-maker/src/config.mjs"
|
|
3
3
|
import useShape from "set-state-compare/src/use-shape.js"
|
|
4
4
|
|
|
@@ -30,7 +30,7 @@ const useBreakpoint = () => {
|
|
|
30
30
|
breakpoint: () => calculateBreakPoint()
|
|
31
31
|
})
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
useLayoutEffect(() => {
|
|
34
34
|
window.addEventListener("resize", onCalled)
|
|
35
35
|
|
|
36
36
|
return () => {
|
package/src/use-can-can.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import CanCan from "./can-can.mjs"
|
|
2
|
-
import {useCallback, useMemo, useState} from "react"
|
|
2
|
+
import {useCallback, useLayoutEffect, useMemo, useState} from "react"
|
|
3
3
|
import useCurrentUser from "./use-current-user.mjs"
|
|
4
4
|
import useShape from "set-state-compare/src/use-shape.js"
|
|
5
5
|
|
|
@@ -31,7 +31,7 @@ const useCanCan = (abilitiesCallback, dependencies) => {
|
|
|
31
31
|
loadAbilities()
|
|
32
32
|
}, dependencies)
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
useLayoutEffect(() => {
|
|
35
35
|
CanCan.current().events.addListener("onResetAbilities", onResetAbilities)
|
|
36
36
|
|
|
37
37
|
return () => {
|
package/src/use-collection.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import debounce from "debounce"
|
|
|
2
2
|
import {digg} from "diggerize"
|
|
3
3
|
import * as inflection from "inflection"
|
|
4
4
|
import ModelEvents from "./model-events.mjs"
|
|
5
|
-
import {useCallback, useMemo} from "react"
|
|
5
|
+
import {useCallback, useLayoutEffect, useMemo} from "react"
|
|
6
6
|
import useCreatedEvent from "./use-created-event.mjs"
|
|
7
7
|
import useShape from "set-state-compare/src/use-shape.js"
|
|
8
8
|
import useQueryParams from "on-location-changed/src/use-query-params.js"
|
|
@@ -251,7 +251,7 @@ const useCollection = (props, cacheKeys = []) => {
|
|
|
251
251
|
|
|
252
252
|
useCreatedEvent(s.p.modelClass, onCreated)
|
|
253
253
|
|
|
254
|
-
|
|
254
|
+
useLayoutEffect(() => {
|
|
255
255
|
const connections = []
|
|
256
256
|
|
|
257
257
|
if (s.s.models) {
|
|
@@ -2,7 +2,7 @@ import debounceFunction from "debounce"
|
|
|
2
2
|
import ModelEvents from "./model-events.mjs"
|
|
3
3
|
import PropTypes from "prop-types"
|
|
4
4
|
import propTypesExact from "prop-types-exact"
|
|
5
|
-
import {useCallback,
|
|
5
|
+
import {useCallback, useLayoutEffect} from "react"
|
|
6
6
|
import useShape from "set-state-compare/src/use-shape.js"
|
|
7
7
|
|
|
8
8
|
const ApiMakerUseCreatedEvent = (modelClass, onCreated, args = {}) => {
|
|
@@ -33,7 +33,7 @@ const ApiMakerUseCreatedEvent = (modelClass, onCreated, args = {}) => {
|
|
|
33
33
|
}
|
|
34
34
|
}, [])
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
useLayoutEffect(() => {
|
|
37
37
|
const connectCreated = ModelEvents.connectCreated(s.p.modelClass, (...args) => onCreatedCallback(...args))
|
|
38
38
|
|
|
39
39
|
return () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useCallback, useMemo} from "react"
|
|
1
|
+
import {useCallback, useLayoutEffect, useMemo} from "react"
|
|
2
2
|
import debounceFunction from "debounce"
|
|
3
3
|
import ModelEvents from "./model-events.mjs"
|
|
4
4
|
import useShape from "set-state-compare/src/use-shape.js"
|
|
@@ -34,7 +34,7 @@ const apiMakerUseDestroyedEvent = (model, onDestroyed, props) => {
|
|
|
34
34
|
}
|
|
35
35
|
}, [])
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
useLayoutEffect(() => {
|
|
38
38
|
let connectDestroyed, onConnectedListener
|
|
39
39
|
|
|
40
40
|
if (model) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {useCallback,
|
|
1
|
+
import {useCallback, useLayoutEffect} from "react"
|
|
2
2
|
|
|
3
3
|
const ApiMakerUseEventListener = (target, event, onCalled) => {
|
|
4
4
|
const onCalledCallback = useCallback((...args) => {
|
|
5
5
|
onCalled.apply(null, args)
|
|
6
6
|
}, [target, event, onCalled])
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
useLayoutEffect(() => {
|
|
9
9
|
if (target) {
|
|
10
10
|
target.addEventListener(event, onCalledCallback)
|
|
11
11
|
|
package/src/use-model.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useCallback, useMemo, useState} from "react"
|
|
1
|
+
import {useCallback, useLayoutEffect, useMemo, useState} from "react"
|
|
2
2
|
import Devise from "./devise.mjs"
|
|
3
3
|
import * as inflection from "inflection"
|
|
4
4
|
import ModelEvents from "./model-events.mjs"
|
|
@@ -95,7 +95,7 @@ const useModel = (modelClassArg, argsArg = {}) => {
|
|
|
95
95
|
cacheArgs
|
|
96
96
|
)
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
useLayoutEffect(() => {
|
|
99
99
|
let reloadModelCallback
|
|
100
100
|
|
|
101
101
|
if (args.events) {
|
|
@@ -109,7 +109,7 @@ const useModel = (modelClassArg, argsArg = {}) => {
|
|
|
109
109
|
}
|
|
110
110
|
}, [args.events])
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
useLayoutEffect(() => {
|
|
113
113
|
let connectUpdated
|
|
114
114
|
|
|
115
115
|
if (model && args.eventUpdated) {
|
|
@@ -129,7 +129,7 @@ const useModel = (modelClassArg, argsArg = {}) => {
|
|
|
129
129
|
loadModel()
|
|
130
130
|
}, [])
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
useLayoutEffect(() => {
|
|
133
133
|
Devise.events().addListener("onDeviseSignIn", onSignedIn)
|
|
134
134
|
Devise.events().addListener("onDeviseSignOut", onSignedOut)
|
|
135
135
|
|
|
@@ -147,7 +147,7 @@ const useModel = (modelClassArg, argsArg = {}) => {
|
|
|
147
147
|
s.p.onDestroyed(forwardArgs)
|
|
148
148
|
}, [])
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
useLayoutEffect(() => {
|
|
151
151
|
let connectDestroyed
|
|
152
152
|
|
|
153
153
|
if (model && args.onDestroyed) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useCallback, useMemo} from "react"
|
|
1
|
+
import {useCallback, useLayoutEffect, useMemo} from "react"
|
|
2
2
|
import useShape from "set-state-compare/src/use-shape.js"
|
|
3
3
|
|
|
4
4
|
const useResizeObserver = (element, callback) => {
|
|
@@ -8,7 +8,7 @@ const useResizeObserver = (element, callback) => {
|
|
|
8
8
|
}, [])
|
|
9
9
|
const observer = useMemo(() => new ResizeObserver(onResize), [])
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
useLayoutEffect(() => {
|
|
12
12
|
if (element) {
|
|
13
13
|
observer.observe(element)
|
|
14
14
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useCallback, useMemo} from "react"
|
|
1
|
+
import {useCallback, useLayoutEffect, useMemo} from "react"
|
|
2
2
|
import debounceFunction from "debounce"
|
|
3
3
|
import ModelEvents from "./model-events.mjs"
|
|
4
4
|
import useShape from "set-state-compare/src/use-shape.js"
|
|
@@ -32,7 +32,7 @@ const apiMakerUseUpdatedEvent = (model, onUpdated, {active = true, debounce, onC
|
|
|
32
32
|
}
|
|
33
33
|
}, [])
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
useLayoutEffect(() => {
|
|
36
36
|
let connectUpdated, onConnectedListener
|
|
37
37
|
|
|
38
38
|
if (model) {
|