@@ -11,6 +11,8 @@ import ReactDOM from "react-dom";
1111import { ContextContent } from "./DiscourseContext" ;
1212import useInViewport from "react-in-viewport/dist/es/lib/useInViewport" ;
1313import normalizePageTitle from "roamjs-components/queries/normalizePageTitle" ;
14+ import { USE_REIFIED_RELATIONS } from "~/data/userSettings" ;
15+ import { getSetting } from "~/utils/extensionSettings" ;
1416import deriveDiscourseNodeAttribute from "~/utils/deriveDiscourseNodeAttribute" ;
1517import getSettingValueFromTree from "roamjs-components/util/getSettingValueFromTree" ;
1618import getBasicTreeByParentUid from "roamjs-components/queries/getBasicTreeByParentUid" ;
@@ -31,18 +33,11 @@ type DiscourseData = {
3133 refs : number ;
3234} ;
3335
34- const cache : {
35- [ tag : string ] : DiscourseData ;
36- } = { } ;
37-
3836const getOverlayInfo = async (
3937 tag : string ,
4038 ignoreCache ?: boolean ,
4139) : Promise < DiscourseData > => {
4240 try {
43- if ( ignoreCache ) delete cache [ tag ] ;
44- if ( cache [ tag ] ) return cache [ tag ] ;
45-
4641 const relations = getDiscourseRelations ( ) ;
4742 const nodes = getDiscourseNodes ( relations ) ;
4843
@@ -58,10 +53,10 @@ const getOverlayInfo = async (
5853 ) ,
5954 ] ) ;
6055
61- return ( cache [ tag ] = {
56+ return {
6257 results,
6358 refs : refs . length ,
64- } ) ;
59+ } ;
6560 } catch ( error ) {
6661 console . error ( `Error getting overlay info for ${ tag } :` , error ) ;
6762 return {
@@ -226,6 +221,8 @@ const useDiscourseContext = (uid: string, tag: string) => {
226221 uid,
227222 score,
228223 numResults,
224+ ignoreCache,
225+ reified : getSetting < boolean > ( USE_REIFIED_RELATIONS ) ,
229226 } ,
230227 } ) ;
231228 }
0 commit comments