diff --git a/static/js/TopicPage.jsx b/static/js/TopicPage.jsx index ac4a260baa..6e237a9fda 100644 --- a/static/js/TopicPage.jsx +++ b/static/js/TopicPage.jsx @@ -585,13 +585,13 @@ const TopicPage = ({ useEffect( ()=> { // hack to redirect to temporary sheet content on topics page for those topics that only have sheet content. - if (document.querySelector('.filter-content') && !document.querySelector('.filter-content').firstChild) { + if (!Sefaria.is_moderator && !topicData.isLoading && Object.keys(topicData.tabs).length == 0){ const interfaceIsHe = Sefaria.interfaceLang === "hebrew" const topicPath = interfaceIsHe ? topicTitle.he : topicTitle.en; const redirectUrl = `${document.location.origin}/search?q=${topicPath}&tab=sheet&tvar=1&tsort=relevance&stopics_${interfaceIsHe ? "he": "en"}Filters=${topicPath}&svar=1&ssort=relevance` window.location.replace(redirectUrl); } - },[loadedData]) + },[topicData]) // Set up tabs and register incremental load hooks const displayTabs = []; diff --git a/static/js/sefaria/sefaria.js b/static/js/sefaria/sefaria.js index be2da1ea30..1adbefbe45 100644 --- a/static/js/sefaria/sefaria.js +++ b/static/js/sefaria/sefaria.js @@ -2738,7 +2738,7 @@ _media: {}, const allRefs = [...tabs["notable-sources"].refs, ...tabs.sources.refs]; tabs.sources.refs = allRefs; } - if (Sefaria.is_moderator){ + if (Sefaria.is_moderator && Object.keys(tabs).length > 0){ tabs["admin"] = {...tabs["sources"]}; tabs["admin"].title = {en: 'Admin', he: Sefaria.translation('hebrew', "Admin")};