Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 63257bd

Browse files
committed
fix bug where a chapter edit would remove its lessons and examples
1 parent 2f1d33b commit 63257bd

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/components/ChapterCreate.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ const ChapterCreate = ({ topicId }: ChapterCreateProps) => {
3636
createdAt: timestamp,
3737
createdBy: profile,
3838
createdById: user.uid,
39+
examples: [],
3940
language: appLanguage,
41+
lessons: [],
4042
likes: 0,
4143
topics: [topicId],
4244
updatedAt: timestamp,

src/components/ChapterForm.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ const ChapterForm = ({
5353
valid={valid}
5454
saving={saving}
5555
onDelete={onDelete}
56-
onSubmit={() =>
57-
onSubmit({ description, examples: [], lessons: [], title })
58-
}
56+
onSubmit={() => onSubmit({ description, title })}
5957
>
6058
<Grid container spacing={2}>
6159
<Grid item xs={12}>

src/models/chapter.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ export namespace Chapter {
1515

1616
export interface EditableFields {
1717
description: string;
18-
examples: string[];
19-
lessons: string[];
2018
title: string;
2119
}
2220

23-
interface Fields extends EditableFields {}
21+
interface Fields extends EditableFields {
22+
examples: string[];
23+
lessons: string[];
24+
}
2425

2526
/**
2627
* Required fields for creating a chapter.

src/models/topic.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import { SearchIndex } from './search';
88
*/
99
export namespace Topic {
1010
interface EditableFields {
11-
chapters: string[];
1211
description: string;
1312
photo: string | null;
1413
}
1514

1615
interface Fields extends EditableFields {
16+
chapters: string[];
1717
posts: number;
1818
title: string;
1919
}

0 commit comments

Comments
 (0)