mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: always dimiss select state regardless of modification #341
This commit is contained in:
parent
a7defca2c3
commit
53bae7cbb3
4 changed files with 6 additions and 5 deletions
|
|
@ -88,7 +88,7 @@ function ActivityElement(props: ActivitiyElementProps) {
|
||||||
modifiedActivity?.activityId === activityId &&
|
modifiedActivity?.activityId === activityId &&
|
||||||
selectedActivity !== undefined
|
selectedActivity !== undefined
|
||||||
) {
|
) {
|
||||||
setSelectedActivity(undefined)
|
|
||||||
let modifiedActivityCopy = {
|
let modifiedActivityCopy = {
|
||||||
...props.activity,
|
...props.activity,
|
||||||
name: modifiedActivity.activityName,
|
name: modifiedActivity.activityName,
|
||||||
|
|
@ -99,6 +99,7 @@ function ActivityElement(props: ActivitiyElementProps) {
|
||||||
await revalidateTags(['courses'], props.orgslug)
|
await revalidateTags(['courses'], props.orgslug)
|
||||||
router.refresh()
|
router.refresh()
|
||||||
}
|
}
|
||||||
|
setSelectedActivity(undefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ function ChapterElement(props: ChapterElementProps) {
|
||||||
|
|
||||||
async function updateChapterName(chapterId: string) {
|
async function updateChapterName(chapterId: string) {
|
||||||
if (modifiedChapter?.chapterId === chapterId) {
|
if (modifiedChapter?.chapterId === chapterId) {
|
||||||
setSelectedChapter(undefined)
|
|
||||||
let modifiedChapterCopy = {
|
let modifiedChapterCopy = {
|
||||||
name: modifiedChapter.chapterName,
|
name: modifiedChapter.chapterName,
|
||||||
}
|
}
|
||||||
|
|
@ -61,6 +60,7 @@ function ChapterElement(props: ChapterElementProps) {
|
||||||
await revalidateTags(['courses'], props.orgslug)
|
await revalidateTags(['courses'], props.orgslug)
|
||||||
router.refresh()
|
router.refresh()
|
||||||
}
|
}
|
||||||
|
setSelectedChapter(undefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -46,17 +46,17 @@ function Activity(props: any) {
|
||||||
modifiedActivity?.activityId === activityId &&
|
modifiedActivity?.activityId === activityId &&
|
||||||
selectedActivity !== undefined
|
selectedActivity !== undefined
|
||||||
) {
|
) {
|
||||||
setSelectedActivity(undefined)
|
|
||||||
let modifiedActivityCopy = {
|
let modifiedActivityCopy = {
|
||||||
...props.activity,
|
...props.activity,
|
||||||
name: modifiedActivity.activityName,
|
name: modifiedActivity.activityName,
|
||||||
}
|
}
|
||||||
|
|
||||||
await updateActivity(modifiedActivityCopy, activityId, session.data?.tokens?.access_token)
|
await updateActivity(modifiedActivityCopy, activityId, session.data?.tokens?.access_token)
|
||||||
await mutate(`${getAPIUrl()}chapters/meta/course_${props.courseid}`)
|
await mutate(`${getAPIUrl()}chapters/meta/course_${props.courseid}`)
|
||||||
await revalidateTags(['courses'], props.orgslug)
|
await revalidateTags(['courses'], props.orgslug)
|
||||||
router.refresh()
|
router.refresh()
|
||||||
}
|
}
|
||||||
|
setSelectedActivity(undefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ function Chapter(props: any) {
|
||||||
|
|
||||||
async function updateChapterName(chapterId: string) {
|
async function updateChapterName(chapterId: string) {
|
||||||
if (modifiedChapter?.chapterId === chapterId) {
|
if (modifiedChapter?.chapterId === chapterId) {
|
||||||
setSelectedChapter(undefined)
|
|
||||||
let modifiedChapterCopy = {
|
let modifiedChapterCopy = {
|
||||||
name: modifiedChapter.chapterName,
|
name: modifiedChapter.chapterName,
|
||||||
}
|
}
|
||||||
|
|
@ -37,6 +36,7 @@ function Chapter(props: any) {
|
||||||
await revalidateTags(['courses'], props.orgslug)
|
await revalidateTags(['courses'], props.orgslug)
|
||||||
router.refresh()
|
router.refresh()
|
||||||
}
|
}
|
||||||
|
setSelectedChapter(undefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue