Skip to content

Commit 919097d

Browse files
committed
回答がない場合にローディングが表示され続ける不具合を修正
同時に、不要なクラスも削除している
1 parent e6b8686 commit 919097d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/javascript/answer.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ document.addEventListener('DOMContentLoaded', () => {
1414
const answers = document.querySelectorAll('.answer')
1515
const loadingContent = document.querySelector('.loading-content')
1616
const answerContent = document.querySelector('.answer-content')
17-
if (answers.length > 0) {
17+
18+
if (loadingContent && answerContent) {
1819
loadingContent.style.display = 'none'
1920
answerContent.style.display = 'block'
21+
}
2022

23+
if (answers.length > 0) {
2124
answers.forEach((answer) => {
2225
initializeAnswer(answer)
2326
})

app/views/questions/show.html.slim

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ hr.a-border
3535
.answer-content style='display: none;'
3636
- if @question.ai_answer
3737
= render 'ai_answer', question: @question
38-
header.thread-comments__header.answer-content
38+
header.thread-comments__header
3939
h2.thread-comments__title
4040
| 回答・コメント
4141
.answers-list

0 commit comments

Comments
 (0)