Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkStampを非Vue化した #8194

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
9 changes: 4 additions & 5 deletions app/javascript/check-stamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export const setCheckStamp = () => {

const checkableType = checkStamp.getAttribute('data-checkable-type')
const checkableId = checkStamp.getAttribute('data-checkable-id')
store.dispatch('setCheckable', {
Copy link
Contributor Author

@mousu-a mousu-a Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この処理(store.jsのcheckIdのセット)が遅いと、commentsテスト(日報にコメントをする処理のあるテスト)でコメントをする時に、日報をチェック済みかどうか?の確認(store.jsのcheckIdのセット)がコメントをするタイミングに間に合わず、日報がチェック済みであるにも関わらずアラートが出てしまうことがあります。それによりテストが落ちやすくなっていたため、コードを上に移動させました。
日報を確認済みにしていませんがよろしいですか?
9a5cc64

checkableId: checkableId,
checkableType: checkableType
})
fetch(
`/api/checks.json/?checkable_type=${checkableType}&checkable_id=${checkableId}`,
{
Expand All @@ -37,11 +41,6 @@ export const setCheckStamp = () => {
const checkedCreatedAt = document.querySelector('.is-created-at')
checkedUserName.textContent = json[0].user.login_name
checkedCreatedAt.textContent = json[0].created_at

store.dispatch('setCheckable', {
checkableId: checkableId,
checkableType: checkableType
})
})
.catch((error) => {
console.warn(error)
Expand Down