updated serching to reduce CRM calls for performance and stability

This commit is contained in:
2025-10-28 11:21:38 +00:00
parent df199cff53
commit e54a0b2253
12 changed files with 265 additions and 164 deletions
+5 -10
View File
@@ -107,17 +107,14 @@ export const getServerSideProps = wrapper.getServerSideProps(
loggedInUser = loggedInUser.value[0].contactid;
const [accountDetails, searchResultsObj, watchedCases] =
await Promise.all([
await getPersonalAccount(loggedInUser),
await getAdvancedSearch(query),
await getWatchedCases(loggedInUser),
]);
const [accountDetails, watchedCases] = await Promise.all([
await getPersonalAccount(loggedInUser),
await getWatchedCases(loggedInUser),
]);
console.log(accountDetails);
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
await getSearchDetails(searchResultsObj),
const [watchedCasesDetails] = await Promise.all([
await getDetails(watchedCases, "myWatchedCases"),
]);
@@ -126,8 +123,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setShowReps(showReps, showLoginCheck));
store.dispatch(setAccountDetails(accountDetails));
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(setWatchedCases(watchedCases));
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
store.dispatch(setSearch(Object.entries(query)));
+15 -18
View File
@@ -161,31 +161,28 @@ export const getServerSideProps = wrapper.getServerSideProps(
},
};
} else {
let [accountDetails, searchResultsObj, watchedCases] =
await Promise.all([
await getPersonalAccount(loggedInUser),
await getBasicDNSSearch(),
await getWatchedCases(loggedInUser),
]);
let [accountDetails, watchedCases] = await Promise.all([
await getPersonalAccount(loggedInUser),
await getWatchedCases(loggedInUser),
]);
searchResultsObj =
searchResultsObj.status == 502
? {
value: [],
errorCode: searchResultsObj.status,
errorMsg: searchResultsObj.statusText,
}
: searchResultsObj;
// searchResultsObj =
// searchResultsObj.status == 502
// ? {
// value: [],
// errorCode: searchResultsObj.status,
// errorMsg: searchResultsObj.statusText,
// }
// : searchResultsObj;
const showMapCheck = process.env.SHOWMAPS || false;
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
await getSearchDetails(searchResultsObj),
const [watchedCasesDetails] = await Promise.all([
await getDetails(watchedCases, "myWatchedCases"),
]);
const dnsCoords = await getDNSCoords();
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
// store.dispatch(setSearchResults(searchResultsObj));
// store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(setSearch("DNS"));
store.dispatch(setDNSCoords(dnsCoords));
store.dispatch(setWatchedCases(watchedCases));
+5 -19
View File
@@ -100,20 +100,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
},
};
} else {
let [searchResultsObj, loggedInUser] = await Promise.all([
await getBasicSearch(query.q),
let [loggedInUser] = await Promise.all([
await getPortalLogin(thisSession.user.email),
]);
searchResultsObj =
searchResultsObj.status == 502
? {
value: [],
errorCode: searchResultsObj.status,
errorMsg: searchResultsObj.statusText,
}
: searchResultsObj;
//console.log("sssss", searchResultsObj);
loggedInUser = loggedInUser.value[0].contactid;
@@ -122,15 +112,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
//console.log("sssss", loggedInUser);
const [accountDetails, searchDetailsObj, watchedCasesDetails] =
await Promise.all([
await getPersonalAccount(loggedInUser),
await getSearchDetails(searchResultsObj),
await getDetails(watchedCases, "myWatchedCases"),
]);
const [accountDetails, watchedCasesDetails] = await Promise.all([
await getPersonalAccount(loggedInUser),
await getDetails(watchedCases, "myWatchedCases"),
]);
store.dispatch(setAccountDetails(accountDetails));
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(setSearch(query.q));
store.dispatch(setWatchedCases(watchedCases));
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));