mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-06 02:00:46 +00:00
fixed likes not loading
This commit is contained in:
1 parent
72086fb526
commit
4cd834e04c
3 files changed
+6
-9
No files matched your search
@@ -57,11 +57,11 @@ export default function useBatchContent({
|
||||
const dlog = (...dbg: any) => debug ? console.log(...dbg) : {};
|
||||
|
||||
const gather = ({ expand, key, res }: Gather) => {
|
||||
let tokens = res.results ? res.results.map((item: any) => item.detail ? item.details[key] : item[key]) : [res[key]];
|
||||
let abc = tokens.reduce((obj = {},token = "") => ({ ...obj, [token]: true }),{})
|
||||
let tokens = res.results ? res.results.map((item: any) => (item.details || item)[key]) : [res[key]];
|
||||
let loadingTokens = tokens.reduce((obj = {},token = "") => ({ ...obj, [token]: true }),{})
|
||||
dlog("🪙",fetcher);
|
||||
tokenTypeSet(key)
|
||||
busyListSet(abc); // add current batch to busy list
|
||||
busyListSet(loadingTokens); // add current batch to busy list
|
||||
fetcher("",{},{ tokens }).then((batchRes: any) => {
|
||||
|
||||
// console.log("🦄",resultsKey, res, modLibrary);
|
||||
|
||||
@@ -95,7 +95,7 @@ export default function useLazyLists({
|
||||
if (urlUpdate) { history.replace({ pathname, search }); }
|
||||
|
||||
fetcher("", {}, queries).then((res: any) => {
|
||||
// if (debug)
|
||||
if (debug)
|
||||
console.log(`🐞 useLazyLists success debug at: ${debug}`, res);
|
||||
statusSet(FetchStatus.success);
|
||||
onSuccess(res);
|
||||
@@ -115,7 +115,6 @@ export default function useLazyLists({
|
||||
// Key exists, just update the existing data
|
||||
const updatedObj = { ...prevObj };
|
||||
updatedObj[keyExists] = res.results;
|
||||
console.log("💛",updatedObj);
|
||||
return updatedObj;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,13 +37,11 @@ export default function useRatings() {
|
||||
|
||||
let result = res.results ? res.results.find((item: any, i: number) =>
|
||||
{
|
||||
return item.details[tokenType] === entity_token || item[tokenType] === entity_token
|
||||
return (item.details || item)[tokenType] === entity_token
|
||||
}
|
||||
) : res;
|
||||
|
||||
let { positive_rating_count } = result.details.stats || result.stats;
|
||||
|
||||
// let { positive_rating_count } = res.results ? itemMatch.details.stats || itemMatch.details.stats
|
||||
let { positive_rating_count } = (result.details || result).stats;
|
||||
|
||||
return { ...current, positive_rating_count };
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user