mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-31 23:28:34 -04:00
Replace Luxon DateTime with number in redux state
Luxon DateTimes are not serializable for redux. Therefore redux throws errors. Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
0d325b5e3b
commit
0d30b599d8
6 changed files with 15 additions and 13 deletions
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { DateTime } from 'luxon'
|
||||
import type { NoteDetails } from './types/note-details'
|
||||
import { NoteTextDirection, NoteType } from './types/note-details'
|
||||
import type { SlideOptions } from './types/slide-show-options'
|
||||
|
@ -18,7 +17,6 @@ export const initialSlideOptions: SlideOptions = {
|
|||
}
|
||||
|
||||
export const initialState: NoteDetails = {
|
||||
updatedAt: DateTime.fromSeconds(0),
|
||||
updateUsername: null,
|
||||
version: 0,
|
||||
markdownContent: {
|
||||
|
@ -35,7 +33,8 @@ export const initialState: NoteDetails = {
|
|||
slideOptions: initialSlideOptions
|
||||
},
|
||||
id: '',
|
||||
createdAt: DateTime.fromSeconds(0),
|
||||
createdAt: 0,
|
||||
updatedAt: 0,
|
||||
aliases: [],
|
||||
primaryAddress: '',
|
||||
permissions: {
|
||||
|
|
|
@ -114,8 +114,8 @@ describe('build state from set note data from server', () => {
|
|||
firstHeading: '',
|
||||
rawFrontmatter: '',
|
||||
id: 'id',
|
||||
createdAt: DateTime.fromISO('2012-05-25T09:08:34.123'),
|
||||
updatedAt: DateTime.fromISO('2020-05-25T09:08:34.123'),
|
||||
createdAt: DateTime.fromISO('2012-05-25T09:08:34.123').toSeconds(),
|
||||
updatedAt: DateTime.fromISO('2020-05-25T09:08:34.123').toSeconds(),
|
||||
updateUsername: 'updateusername',
|
||||
viewCount: 987,
|
||||
aliases: [
|
||||
|
|
|
@ -46,7 +46,7 @@ const convertNoteDtoToNoteDetails = (note: Note): NoteDetails => {
|
|||
lineStartIndexes: calculateLineStartIndexes(newLines)
|
||||
},
|
||||
rawFrontmatter: '',
|
||||
createdAt: DateTime.fromISO(note.metadata.createdAt),
|
||||
updatedAt: DateTime.fromISO(note.metadata.updatedAt)
|
||||
createdAt: DateTime.fromISO(note.metadata.createdAt).toSeconds(),
|
||||
updatedAt: DateTime.fromISO(note.metadata.updatedAt).toSeconds()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { DateTime } from 'luxon'
|
||||
import type { SlideOptions } from './slide-show-options'
|
||||
import type { ISO6391 } from './iso6391'
|
||||
import type { CursorSelection } from '../../editor/types'
|
||||
|
@ -16,8 +15,8 @@ type UnnecessaryNoteAttributes = 'updatedAt' | 'createdAt' | 'tags' | 'descripti
|
|||
* Redux state containing the currently loaded note with its content and metadata.
|
||||
*/
|
||||
export interface NoteDetails extends Omit<NoteMetadata, UnnecessaryNoteAttributes> {
|
||||
updatedAt: DateTime
|
||||
createdAt: DateTime
|
||||
updatedAt: number
|
||||
createdAt: number
|
||||
markdownContent: {
|
||||
plain: string
|
||||
lines: string[]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue