Repository navigation
Keep API comments visible when Markdown anchors cannot render - #294
Conversation
HamptonMakes
left a comment
There was a problem hiding this comment.
I'd rather not change the ubuntu target if we can avoid it... but otherwise LGTM.
| applyFilter() { | ||
| if (!this.hasListTarget) return | ||
| const filter = this.filterTarget.value || "open" | ||
| const comments = [...this.listTarget.querySelectorAll("[data-comment-status]")] |
There was a problem hiding this comment.
its pre-existing but generally we shouldn't be using querySelectorAll at all...
There was a problem hiding this comment.
🤖 Updated in c170cc2. The Comments controller now uses Stimulus targets for its comment entries and disclosure. The text highlighter publishes the IDs of threads it successfully placed, and Comments requests the current snapshot when it connects. The navigation controller also owns its count badge through a target and an event.
This removes the DOM queries from the Comments controller. Browser coverage includes reconnection, Turbo list replacement/removal, and an anchor disappearing so its fallback becomes visible.
What changed and why
API comments quoting Markdown source, such as inline backticks or a table row, could be accepted but have no visible highlight or entry in Comments. Their direct thread links also opened an apparently empty page.
Project source quotes through the document's Markdown text map before highlighting them, preserving the stored quotes, source offsets, and occurrence selection. Keep a document comment entry when the browser cannot place a text anchor, and refresh that entry on replies, resolution, reopening, and deletion. Existing comments benefit without a data migration.
Pin the lint job to Ubuntu 24.04, matching its last successful run. The moving
ubuntu-latestimage selected Ubuntu 26.04, for which the Ruby setup action could not install the required Ruby 3.4.7 runtime.Tracks HOOD-6568.
Evidence
Manually opened a table-row discussion in the local demo in light mode and the source-only fallback discussion in dark mode.
How to try it
bin/rails coplan:demo:seedand sign in ashampton@example.comin the example host.