fix(docs): resolve the real source path for "Edit this page" - #754
Merged
Conversation
`(service "kolay/docs")` resolved to undefined -- kolay registers nothing in
ember's container, its docs state is an ember-primitives store reached with
`docsManager()`. `DocsService` has no public `selected` either, so
`{{docs.selected.path}}` rendered empty and every page's edit link pointed at
`docs-app/app/templates.md`, a 404.
Resolve the current page the way kolay's own private selected-page state does:
split query params / hash off the app-relative `router.currentURL` and look the
result up with `findByPath`, which matches with or without the `.md` extension.
The manifest page's `appRelativePath` is the file's location under
`app/templates` with the extension already on it, so the template's trailing
".md" goes away too (`path` is unusable here -- it carries the deployed
rootURL prefix).
Verified against a production build served under a rootURL: the link resolves
to the real source file for a top-level page, for a page inside a family folder
(2-components/skeleton/icon.md), for a family index page, and for the
extension-less form of a URL.
Signed-off-by: Patrick Pircher <patrick.pircher@ibm.com>
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.
Summary
(service "kolay/docs")resolved toundefined— kolay doesn't register anything in Ember's container; its docs state lives in an ember-primitives store reached viadocsManager().router.currentURLand looks it up withfindByPath(matches with or without.md).docs-app/app/templates.md).Test plan
2-components/skeleton/icon.md), a family index page, and the extension-less form of a URL.pnpm glintin docs-app shows no new errors introduced by this change (pre-existing unrelated errors intheme-support.gts/application.tsare untouched).Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com