mirror of
https://github.com/stronk-dev/LivepeerEvents.git
synced 2025-07-05 02:35:09 +02:00
Make silent preload of orchestrator info not modify local browser cache and also look at delegator cache before preloading
This commit is contained in:
parent
9cd691afae
commit
e69338ed5f
@ -146,14 +146,8 @@ export const getCurrentOrchestratorInfo = () => async dispatch => {
|
||||
return dispatch(receiveErrors(data));
|
||||
};
|
||||
|
||||
export const getOrchestratorInfoSilent = (orchAddr) => async dispatch => {
|
||||
const response = await apiUtil.getOrchestratorInfo(orchAddr);
|
||||
const data = await response.json();
|
||||
if (response.ok) {
|
||||
if (data && data.id) {
|
||||
return dispatch(cacheNewOrch(data));
|
||||
}
|
||||
}
|
||||
export const getOrchestratorInfoSilent = async (orchAddr) => {
|
||||
apiUtil.getOrchestratorInfo(orchAddr);
|
||||
};
|
||||
|
||||
export const getOrchestratorInfo = (orchAddr) => async dispatch => {
|
||||
|
@ -95,15 +95,27 @@ const EventButtonAddress = (obj) => {
|
||||
|
||||
useEffect(() => {
|
||||
// Check if cached as an orchestrator
|
||||
let shouldUpdate = false;
|
||||
if (livepeer.orchInfo) {
|
||||
for (const thisOrch of livepeer.orchInfo) {
|
||||
if (thisOrch.id === obj.address) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Preload Orch info
|
||||
shouldUpdate = true;
|
||||
}
|
||||
if (livepeer.delInfo) {
|
||||
for (const thisOrch of livepeer.delInfo) {
|
||||
if (thisOrch.id === obj.address) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
shouldUpdate = true;
|
||||
}
|
||||
// Preload Orch info
|
||||
if (shouldUpdate){
|
||||
console.log("Refresh due to non-existing orch in global state");
|
||||
dispatch(getOrchestratorInfoSilent(obj.address));
|
||||
getOrchestratorInfoSilent(obj.address);
|
||||
}
|
||||
}, [livepeer.orchInfo]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user