atom.io 0.44.0 → 0.44.1
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/dist/eslint-plugin/index.d.ts +0 -1
- package/dist/eslint-plugin/index.d.ts.map +1 -1
- package/dist/internal/index.d.ts +269 -269
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/introspection/index.d.ts +3 -3
- package/dist/introspection/index.d.ts.map +1 -1
- package/dist/json/index.d.ts +10 -10
- package/dist/json/index.d.ts.map +1 -1
- package/dist/main/index.d.ts +146 -146
- package/dist/main/index.d.ts.map +1 -1
- package/dist/react/index.js +4 -3
- package/dist/react/index.js.map +1 -1
- package/dist/react-devtools/index.d.ts +12 -12
- package/dist/react-devtools/index.d.ts.map +1 -1
- package/dist/realtime/index.d.ts +3 -3
- package/dist/realtime/index.d.ts.map +1 -1
- package/dist/realtime-server/index.d.ts +3 -3
- package/dist/realtime-server/index.d.ts.map +1 -1
- package/dist/realtime-testing/index.d.ts +4 -4
- package/dist/realtime-testing/index.d.ts.map +1 -1
- package/dist/web/index.d.ts +3 -3
- package/dist/web/index.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/react/use-loadable.ts +4 -3
|
@@ -63,6 +63,7 @@ export function useLoadable(
|
|
|
63
63
|
fallback = params[2]
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
const hasFallback = fallback !== undefined
|
|
66
67
|
const isErr = `catch` in state && state.catch.some((E) => value instanceof E)
|
|
67
68
|
|
|
68
69
|
const wrapperRef = useRef<{
|
|
@@ -84,7 +85,7 @@ export function useLoadable(
|
|
|
84
85
|
if (lastLoaded === `LOADING`) {
|
|
85
86
|
return `LOADING`
|
|
86
87
|
}
|
|
87
|
-
if (wasErr &&
|
|
88
|
+
if (wasErr && hasFallback) {
|
|
88
89
|
wrapper = wrapperRef.current = {
|
|
89
90
|
loading: true,
|
|
90
91
|
value: fallback,
|
|
@@ -96,7 +97,7 @@ export function useLoadable(
|
|
|
96
97
|
} else {
|
|
97
98
|
lastLoadedRef.current = value
|
|
98
99
|
if (wrapper.loading === true) {
|
|
99
|
-
if (isErr &&
|
|
100
|
+
if (isErr && hasFallback) {
|
|
100
101
|
wrapper = wrapperRef.current = {
|
|
101
102
|
loading: false,
|
|
102
103
|
value: fallback,
|
|
@@ -106,7 +107,7 @@ export function useLoadable(
|
|
|
106
107
|
wrapper = wrapperRef.current = { loading: false, value: value }
|
|
107
108
|
}
|
|
108
109
|
} else {
|
|
109
|
-
if (isErr &&
|
|
110
|
+
if (isErr && hasFallback) {
|
|
110
111
|
wrapper.loading = false
|
|
111
112
|
wrapper.value = fallback
|
|
112
113
|
wrapper.error = value
|