Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/app/configure-tasks-app/ui/Subtemplates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@

const { mutate } = useSWRConfig()

const _debounceMutate = async (cacheKey: string) => await mutate(cacheKey)
const _debounceMutate = (cacheKey: string) =>
mutate(cacheKey).catch((error) => console.error('Failed to revalidate subtemplates:', error))
const debounceMutate = useDebounce(_debounceMutate, 200)

useEffect(() => {
Expand All @@ -66,9 +67,9 @@
}

debounceMutate(cacheKey)
}, [activeTemplate?.subTaskTemplates])

Check warning on line 70 in src/app/configure-tasks-app/ui/Subtemplates.tsx

View workflow job for this annotation

GitHub Actions / Run linters and tests

React Hook useEffect has missing dependencies: 'activeTemplate', 'cacheKey', and 'debounceMutate'. Either include them or remove the dependency array

const handleSubtemplateCreation = (payload: CreateTemplateRequest) => {
const handleSubtemplateCreation = async (payload: CreateTemplateRequest) => {
const tempId = generateRandomString('temp-template')
setOptimisticUpdates((prev) => [
...prev,
Expand All @@ -90,7 +91,7 @@
const optimisticData = sortTaskByDescendingOrder([...currentSubtemplates, tempSubtemplate])

try {
mutate(
await mutate(
cacheKey,
async () => {
const subTask = await createSubTemplate(token, template_id, payload)
Expand Down
5 changes: 3 additions & 2 deletions src/app/detail/ui/ActivityWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@

useScrollToElement('commentId')

const _debounceMutate = async (cacheKey: string) => await mutate(cacheKey)
const _debounceMutate = (cacheKey: string) =>
mutate(cacheKey).catch((error) => console.error('Failed to revalidate activity logs:', error))
const debounceMutate = useDebounce(_debounceMutate, 300)

const shouldRefetchRef = useRef(true) //preventing double fetching from comment apis. Due to optimistic update revalidation, we are already fetching logs there. So no need to refetch in case for comment creation and deletion.
Expand All @@ -77,7 +78,7 @@
}
setLastUpdated(task?.lastActivityLogUpdated)
}
}, [task?.lastActivityLogUpdated])

Check warning on line 81 in src/app/detail/ui/ActivityWrapper.tsx

View workflow job for this annotation

GitHub Actions / Run linters and tests

React Hook useEffect has missing dependencies: 'cacheKey', 'debounceMutate', 'lastUpdated', and 'task'. Either include them or remove the dependency array

const currentUserId = tokenPayload.internalUserId ?? tokenPayload.clientId

Expand All @@ -102,7 +103,7 @@
const optimisticData = getOptimisticData(postCommentPayload, activities.data, tempLog)

try {
mutate(
await mutate(
cacheKey,
async () => {
shouldRefetchRef.current = false
Expand Down
7 changes: 4 additions & 3 deletions src/app/detail/ui/Subtasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@

const { mutate } = useSWRConfig()

const _debounceMutate = async (cacheKey: string) => await mutate(cacheKey)
const _debounceMutate = (cacheKey: string) =>
mutate(cacheKey).catch((error) => console.error('Failed to revalidate subtasks:', error))
const debounceMutate = useDebounce(_debounceMutate, 200)

useEffect(() => {
Expand All @@ -82,9 +83,9 @@
debounceMutate(cacheKey)
}
setLastUpdated(activeTask?.lastSubtaskUpdated)
}, [activeTask?.lastSubtaskUpdated])

Check warning on line 86 in src/app/detail/ui/Subtasks.tsx

View workflow job for this annotation

GitHub Actions / Run linters and tests

React Hook useEffect has missing dependencies: 'activeTask', 'cacheKey', 'debounceMutate', and 'lastUpdated'. Either include them or remove the dependency array

const handleSubTaskCreation = (payload: CreateTaskRequest) => {
const handleSubTaskCreation = async (payload: CreateTaskRequest) => {
const tempId = generateRandomString('temp-task')
setOptimisticUpdates((prev) => [
...prev,
Expand All @@ -104,7 +105,7 @@
)
const optimisticData = subTasks?.tasks ? sortSubtasksByPriority([...subTasks.tasks, tempSubtask]) : [tempSubtask]
try {
mutate(
await mutate(
cacheKey,
async () => {
const subTask = await handleCreate(token, payload, { disableSubtaskTemplates: true })
Expand Down
Loading