FIX: preserve calendar view when navigating months - #167
Merged
angusmcleod merged 1 commit intoMay 10, 2026
Merged
Conversation
transitionToMonth() used router.transitionTo({ queryParams })
without a route name, which resolved to the category's base route
instead of the calendar filter route. Combined with the templateName
reset in angusmcleod#166, this caused the view to flip to list on next/previous
month clicks.
Transition explicitly to discovery.calendarCategory (or
discovery.calendar for the global calendar route) to preserve
the calendar filter.
Contributor
Author
|
Note: the Metadata check fails because the plugin version hasn't been bumped. I left this to the maintainer @angusmcleod as with my previous PR (#166) - happy to bump it myself if preferred. All tested and ok from my side, let me know if there is something more to do here. Thanks and BR Richard |
Contributor
Author
|
@angusmcleod - can i support here anyhow to get this PR accepted and merged? |
Contributor
Author
|
Just wondering if this is the right place here @angusmcleod , but last time merge was quick and easy here.. |
Owner
|
Thanks 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After the category route fix in #166, navigating between months in the
calendar view incorrectly switches the view to the list template, even
when the user stays within a calendar-enabled category.
Steps to reproduce:
/c/events/20)/c/events/20?start=...&end=...(note the missing/l/calendar)The same issue affects the global calendar route (
/calendar).Root cause
transitionToMonth()inevents-calendar.jscalled:Without an explicit route name, Ember resolved the transition to the
category's base route (
discovery.category) instead of the calendarfilter route - the
/l/calendarsegment was dropped from the URL.The
afterModelhook inroute:discovery.category(modified in #166to prevent calendar template leaking into non-calendar categories) then
sees
model.filterType !== "calendar"and executes:resetting the template to list. Topics for the new month are loaded
correctly, but rendered in the wrong view.
This bug existed before #166 but was masked by the earlier template
leak - #166 correctly fixed that leak, which surfaced this pre-existing
issue in
transitionToMonth.Fix
Transition explicitly to the correct calendar route so the filter is
preserved in the URL:
discovery.calendarCategorywithcategory_slug_path_with_idaspositional parameter when a category context exists
discovery.calendarfor the global calendar route (no dynamic segments)The routes
xxxCategoryare dynamically generated by Discourse core'sapp-route-map.js
from
Site.currentProp("filters"), with a single*category_slug_path_with_idglob segment in the format
<slug>/<id>. This matches how Discourse coreitself transitions, e.g. in
build-category-route.js:The
const category = this.get("category")lookup is hoisted to the topof the function since it is now needed both for route selection and in
the existing
.then()callback (minor deduplication).Testing
Tested manually on Discourse Version: 2026.4.0-latest ( 480a052a10 )
/calendar): month navigation stays in calendar viewcorrectly shows list view (regression check for Fix calendar view leaking to non-calendar categories during SPA navigation - Update discourse-events.js #166)
Related