Make comments cache-safe

This commit is contained in:
Jose Farias
2024-10-23 18:58:10 -06:00
parent 208ace7214
commit 8233254de3
8 changed files with 42 additions and 4 deletions
@@ -0,0 +1,13 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static classes = [ "myComment" ]
connect() {
this.#myComments.forEach(comment => comment.classList.add(this.myCommentClass))
}
get #myComments() {
return this.element.querySelectorAll(`.comment[data-creator-id='${Current.user.id}']`)
}
}