Skip to content

Commit 5f5f681

Browse files
authored
Merge pull request #214 from AvaCodeSolutions/fix/213/lesson-cache-issue
fix: #213 fix lesson cache
2 parents f0e40c0 + 0d911d2 commit 5f5f681

2 files changed

Lines changed: 2 additions & 11 deletions

File tree

frontend/platform/course/Course.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function Course() {
2424
const platformBaseUrl = localStorage.getItem('platformBaseUrl');
2525
const [dialogOpen, setDialogOpen] = useState(false)
2626
const [dialogContent, setDialogContent] = useState(null)
27-
const [lessonCache, setLessonCache] = useState("")
2827
const [contentLoaded, setContentLoaded] = useState(false)
2928
const [dialogMaxWidth, setDialogMaxWidth] = useState('lg');
3029
const [enrollmentsCount, setEnrollmentsCount] = useState(null);
@@ -146,8 +145,7 @@ function Course() {
146145
header={localeMessages["update_lesson"]}
147146
initialTitle={content.lesson.title}
148147
initialContent={content.lesson.content}
149-
onContentChange={setLessonCache}
150-
cancelCallback={() => {setLessonCache(""); setDialogOpen(false);}}
148+
cancelCallback={() => {setDialogOpen(false);}}
151149
successCallback={resetDialog}
152150
courseId={course_id}
153151
lessonId={content.lesson.id}
@@ -215,8 +213,6 @@ function Course() {
215213
{userRole !== 'viewer' && <><Button variant="contained" startIcon={<DescriptionIcon sx={{ marginLeft: direction == 'rtl' ? 1 : 0 }} />} sx={{ marginBottom: 2 }} onClick={() => {
216214
setDialogContent(<Suspense fallback={<Box sx={{ p: 2 }}><LinearProgress /></Box>}><LessonForm
217215
header={localeMessages["new_lesson"]}
218-
initialContent={lessonCache}
219-
onContentChange={setLessonCache}
220216
cancelCallback={() => setDialogOpen(false)}
221217
successCallback={resetDialog}
222218
courseId={course_id} /></Suspense>);

frontend/platform/course/components/LessonForm.jsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import RequiredTextField from '../../../src/components/RequiredTextField.jsx';
44
import ContentEditor from '../../../src/components/ContentEditor.jsx';
55
import { getCookie } from '../../../src/utils.js';
66

7-
function LessonForm({ header, initialTitle, initialContent, onContentChange, cancelCallback, successCallback, courseId, lessonId, initialWaitingPeriod, contentId }) {
7+
function LessonForm({ header, initialTitle, initialContent, cancelCallback, successCallback, courseId, lessonId, initialWaitingPeriod, contentId }) {
88
const [title, setTitle] = useState(initialTitle || "");
99
const [content, setContent] = useState(initialContent || "");
1010
const [waitingPeriod, setWaitingPeriod] = useState(initialWaitingPeriod ? initialWaitingPeriod.period : 1);
@@ -87,11 +87,6 @@ function LessonForm({ header, initialTitle, initialContent, onContentChange, can
8787
});
8888
}
8989

90-
91-
useEffect(() => {
92-
onContentChange(content);
93-
}, [content]);
94-
9590
const handleContentChange = (newContent) => {
9691
setContent(newContent);
9792
}

0 commit comments

Comments
 (0)