Fix breadcrumbs teleport error on singleton edit views#617
Open
Bhavatu wants to merge 1 commit into
Open
Conversation
Singleton settings views (PlanFeatures, NotificationSettings, etc.) mix in
SuccessUrlEditPageMixin, which returns [] from get_breadcrumbs_items() to
hide the snippet breadcrumb trail. With empty breadcrumbs, Wagtail renders
shared/header.html instead of slim_header.html, so the live DOM contains no
`header [data-w-breadcrumbs]` element. The upstream edit_partials.html still
unconditionally emits a w-teleport into that selector, which made every AJAX
save raise a Stimulus "No valid target container found" error in the browser.
Override edit_partials.html via WatchEditView.partials_template_name and
guard only the breadcrumbs block behind {% if breadcrumbs_items %}, falling
back to {{ block.super }} for the rest so upstream teleports for title,
side panels and history continue to work.
Fixes WATCH-BACKEND-3N8
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.
Description
Singleton settings views (PlanFeatures, NotificationSettings, etc.) mix in SuccessUrlEditPageMixin, which returns [] from get_breadcrumbs_items() to hide the snippet breadcrumb trail. With empty breadcrumbs, Wagtail renders shared/header.html instead of slim_header.html, so the live DOM contains no
header [data-w-breadcrumbs]element. The upstream edit_partials.html still unconditionally emits a w-teleport into that selector, which made every AJAX save raise a Stimulus "No valid target container found" error in the browser.Override edit_partials.html via WatchEditView.partials_template_name and guard only the breadcrumbs block behind {% if breadcrumbs_items %}, falling back to {{ block.super }} for the rest so upstream teleports for title, side panels and history continue to work.
Fixes WATCH-BACKEND-3N8
Screenshots/Videos (if applicable)
Add screenshots or videos demonstrating the changes if applicable.
Related issue
E.g. Link to asana, sentry, slack thread etc.
Requirements, dependencies and related PRs
Describe or link possible requirements, dependencies and related PRs here
Additional Notes
Any additional information that reviewers should know about this PR.
✅ Pre-Merge Checklist
Type of Change
Testing
Manual testing instructions
Error: No valid target container found at 'header [data-w-breadcrumbs]'.should not pop up anymore.Internationalization & Accessibility
Integrations (if applicable)
If there are model changes to models which use any of the features below, verify the new models work together with the features.
For example, when adding a new model, verify the new model instances are copied when copying a plan.
Dependencies