@redocly/theme 0.68.0 → 0.68.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.
|
@@ -45,15 +45,16 @@ function getReplayConfiguration(_context) {
|
|
|
45
45
|
}
|
|
46
46
|
function useConfigureReplay(context, isOpened) {
|
|
47
47
|
const [config, setConfig] = (0, react_1.useState)();
|
|
48
|
+
const contextRef = (0, react_1.useRef)(context);
|
|
49
|
+
contextRef.current = context;
|
|
48
50
|
const refresh = (0, react_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
|
49
51
|
try {
|
|
50
|
-
const result = yield getReplayConfiguration(
|
|
52
|
+
const result = yield getReplayConfiguration(contextRef.current);
|
|
51
53
|
setConfig(result);
|
|
52
54
|
}
|
|
53
55
|
catch (error) {
|
|
54
|
-
console.warn('Failed to configure replay for operation:',
|
|
56
|
+
console.warn('Failed to configure replay for operation:', contextRef.current.operation.operationId, error);
|
|
55
57
|
}
|
|
56
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
57
58
|
}), []);
|
|
58
59
|
(0, react_1.useEffect)(() => {
|
|
59
60
|
if (isOpened) {
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState, useCallback } from 'react';
|
|
1
|
+
import { useEffect, useState, useCallback, useRef } from 'react';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
type ConfigureRequestValues,
|
|
@@ -62,18 +62,20 @@ export function useConfigureReplay(context: ContextProps, isOpened: boolean) {
|
|
|
62
62
|
ConfigureRequestValues | ConfigureServerRequestValues | null
|
|
63
63
|
>();
|
|
64
64
|
|
|
65
|
+
const contextRef = useRef(context);
|
|
66
|
+
contextRef.current = context;
|
|
67
|
+
|
|
65
68
|
const refresh = useCallback(async () => {
|
|
66
69
|
try {
|
|
67
|
-
const result = await getReplayConfiguration(
|
|
70
|
+
const result = await getReplayConfiguration(contextRef.current);
|
|
68
71
|
setConfig(result);
|
|
69
72
|
} catch (error) {
|
|
70
73
|
console.warn(
|
|
71
74
|
'Failed to configure replay for operation:',
|
|
72
|
-
|
|
75
|
+
contextRef.current.operation.operationId,
|
|
73
76
|
error,
|
|
74
77
|
);
|
|
75
78
|
}
|
|
76
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77
79
|
}, []);
|
|
78
80
|
|
|
79
81
|
useEffect(() => {
|