diff --git a/reader/views.py b/reader/views.py index 2aae795dee..bf487dcc4b 100644 --- a/reader/views.py +++ b/reader/views.py @@ -902,6 +902,7 @@ def collection_page(request, slug): "initialMenu": "collection", "initialCollectionName": collection.name, "initialCollectionSlug": collection.slug, + "initialCollectionTag": request.GET.get("tag", None), "initialTab": request.GET.get("tab", None) }) diff --git a/static/js/CollectionPage.jsx b/static/js/CollectionPage.jsx index 75baa91247..098f324d6a 100644 --- a/static/js/CollectionPage.jsx +++ b/static/js/CollectionPage.jsx @@ -41,12 +41,18 @@ class CollectionPage extends Component { } componentDidMount() { this.loadData(); + if (!!this.props.tag & !this.props.tab) { + this.props.setTab("sheets"); + } } componentDidUpdate(prevProps, prevState) { if (this.props.slug !== prevProps.slug) { this.setState({collectionData: null}); this.loadData(); } + if (this.props.tab != prevProps.tab) { + this.setState({tab: this.props.tab}); + } if (prevState.sheetFilterTopic !== this.state.sheetFilterTopic && $(".content").scrollTop() > 260) { $(".content").scrollTop(0); } @@ -249,7 +255,7 @@ class CollectionPage extends Component { diff --git a/static/js/ReaderApp.jsx b/static/js/ReaderApp.jsx index 969b485236..2e70524afb 100644 --- a/static/js/ReaderApp.jsx +++ b/static/js/ReaderApp.jsx @@ -412,7 +412,7 @@ class ReaderApp extends Component { "About", "AboutSheet", "Navigation", "WebPages", "extended notes", "Topics", "Torah Readings", "manuscripts", "Lexicon"]); const addTab = (url) => { if (state.tab && state.menuOpen !== "search") { - return url.includes("?") ? url + `&tab=${state.tab}` : url + `?tab=${state.tab}`; + return url + `&tab=${state.tab}` } else { return url; } @@ -506,7 +506,7 @@ class ReaderApp extends Component { case "collection": hist.url = "collections/" + state.collectionSlug; if (states[i].collectionTag) { - hist.url; + hist.url += "&tag=" + state.collectionTag.replace("#","%23"); } hist.title = (state.collectionName ? state.collectionName + " | " : "") + Sefaria._(siteName + " Collections"); hist.mode = "collection";