Skip to content

Commit d8db8de

Browse files
committed
fix: add default form values in upload form
1 parent 0d8199b commit d8db8de

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

apps/frontend/src/modules/song-upload/components/client/context/UploadSong.context.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import { toast } from 'react-hot-toast';
1212
import { create } from 'zustand';
1313

14-
import { BG_COLORS, THUMBNAIL_CONSTANTS } from '@nbw/config';
14+
import { BG_COLORS, THUMBNAIL_CONSTANTS, UPLOAD_CONSTANTS } from '@nbw/config';
1515
import { parseSongFromBuffer, type SongFileType } from '@nbw/song';
1616
import axiosInstance from '@web/lib/axios';
1717
import { InvalidTokenError, getTokenLocal } from '@web/lib/axios/token.utils';
@@ -131,6 +131,14 @@ export const UploadSongProvider = ({
131131
const formMethods = useForm<UploadSongForm>({
132132
resolver: zodResolver(uploadSongFormSchema),
133133
mode: 'onBlur',
134+
// Prevents values from appearing empty on first render
135+
defaultValues: {
136+
category: UPLOAD_CONSTANTS.category.default,
137+
license: UPLOAD_CONSTANTS.license.default,
138+
visibility: 'public',
139+
allowDownload: true,
140+
customInstruments: [],
141+
},
134142
});
135143

136144
const {

0 commit comments

Comments
 (0)