@credithub/harlan-components 1.62.4 → 1.62.5
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.
|
@@ -18,65 +18,73 @@ import { Queries, RequestStatus } from '../webservice';
|
|
|
18
18
|
import ProcessosJuridicosList from './processosJuridicosList';
|
|
19
19
|
var ProcessosJuridicos = function (_a) {
|
|
20
20
|
var onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico;
|
|
21
|
+
console.log('Processos Juridicos Renderizou');
|
|
21
22
|
var ctx = useContext(Queries.ProcessosJuridicos);
|
|
22
23
|
var setData = useGlobalData().setData;
|
|
23
24
|
var processedRef = useRef(false);
|
|
24
25
|
var ctxHashRef = useRef('');
|
|
25
26
|
useEffect(function () {
|
|
26
|
-
var _a;
|
|
27
|
+
var _a, _b;
|
|
27
28
|
var currentCtxHash = JSON.stringify({
|
|
28
29
|
type: ctx.type,
|
|
29
|
-
documentId: ctx.document
|
|
30
|
+
documentId: Boolean(ctx.document)
|
|
30
31
|
});
|
|
31
|
-
var cleanup = undefined;
|
|
32
32
|
if (currentCtxHash === ctxHashRef.current && processedRef.current) {
|
|
33
|
-
return
|
|
33
|
+
return;
|
|
34
34
|
}
|
|
35
35
|
ctxHashRef.current = currentCtxHash;
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (((_a = prevState.processosJuridicosData) === null || _a === void 0 ? void 0 : _a.isLoaded) &&
|
|
44
|
-
Array.isArray(prevState.processosJuridicosData.empresa) &&
|
|
45
|
-
prevState.processosJuridicosData.empresa.length === 0) {
|
|
46
|
-
return prevState;
|
|
47
|
-
}
|
|
48
|
-
return __assign(__assign({}, prevState), { processosJuridicosData: {
|
|
49
|
-
empresa: [],
|
|
50
|
-
isLoaded: true
|
|
51
|
-
} });
|
|
52
|
-
});
|
|
53
|
-
processedRef.current = true;
|
|
36
|
+
if (ctx.type === RequestStatus.Error && !processedRef.current) {
|
|
37
|
+
setData(function (prevState) {
|
|
38
|
+
var _a;
|
|
39
|
+
if (((_a = prevState.processosJuridicosData) === null || _a === void 0 ? void 0 : _a.isLoaded) &&
|
|
40
|
+
Array.isArray(prevState.processosJuridicosData.empresa) &&
|
|
41
|
+
prevState.processosJuridicosData.empresa.length === 0) {
|
|
42
|
+
return prevState;
|
|
54
43
|
}
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
return __assign(__assign({}, prevState), { processosJuridicosData: {
|
|
45
|
+
empresa: [],
|
|
46
|
+
isLoaded: true
|
|
47
|
+
} });
|
|
48
|
+
});
|
|
49
|
+
processedRef.current = true;
|
|
50
|
+
return;
|
|
57
51
|
}
|
|
58
52
|
if (ctx.type === RequestStatus.Success &&
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var
|
|
62
|
-
|
|
53
|
+
ctx.document &&
|
|
54
|
+
!processedRef.current) {
|
|
55
|
+
var documentData_1 = ctx.document;
|
|
56
|
+
var qtyProcessos_1 = (_b = (_a = documentData_1.empresa) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
57
|
+
if (qtyProcessos_1 > 0) {
|
|
63
58
|
var processosJuridicosData_1 = {
|
|
64
|
-
empresa:
|
|
59
|
+
empresa: documentData_1.empresa,
|
|
65
60
|
isLoaded: true
|
|
66
61
|
};
|
|
67
62
|
setData(function (prevState) {
|
|
68
63
|
var _a;
|
|
69
64
|
if (((_a = prevState.processosJuridicosData) === null || _a === void 0 ? void 0 : _a.isLoaded) &&
|
|
70
65
|
JSON.stringify(prevState.processosJuridicosData.empresa) ===
|
|
71
|
-
JSON.stringify(
|
|
66
|
+
JSON.stringify(documentData_1.empresa)) {
|
|
67
|
+
return prevState;
|
|
68
|
+
}
|
|
69
|
+
return __assign(__assign({}, prevState), { processosJuridicos: qtyProcessos_1, processosJuridicosData: processosJuridicosData_1 });
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
setData(function (prevState) {
|
|
74
|
+
var _a;
|
|
75
|
+
if (((_a = prevState.processosJuridicosData) === null || _a === void 0 ? void 0 : _a.isLoaded) &&
|
|
76
|
+
Array.isArray(prevState.processosJuridicosData.empresa) &&
|
|
77
|
+
prevState.processosJuridicosData.empresa.length === 0) {
|
|
72
78
|
return prevState;
|
|
73
79
|
}
|
|
74
|
-
return __assign(__assign({}, prevState), {
|
|
80
|
+
return __assign(__assign({}, prevState), { processosJuridicosData: {
|
|
81
|
+
empresa: [],
|
|
82
|
+
isLoaded: true
|
|
83
|
+
} });
|
|
75
84
|
});
|
|
76
|
-
processedRef.current = true;
|
|
77
85
|
}
|
|
86
|
+
processedRef.current = true;
|
|
78
87
|
}
|
|
79
|
-
return cleanup;
|
|
80
88
|
}, [ctx.type, ctx.document, setData]);
|
|
81
89
|
useEffect(function () {
|
|
82
90
|
if (ctx.type === RequestStatus.Loading) {
|