Skip to content

Commit a83a599

Browse files
committed
Refactor form handling in Details component to save data on blur instead of onChange
1 parent 622a7e4 commit a83a599

File tree

1 file changed

+6
-5
lines changed
  • app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/details

1 file changed

+6
-5
lines changed

app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/details/page.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ const Details = () => {
233233
value={formData.startedOn || ''}
234234
onChange={(e) => {
235235
handleChange('startedOn', e);
236-
handleSave({ ...formData, startedOn: e });
237236
}}
237+
onBlur={() => handleSave(formData)}
238238
/>
239239
</div>
240240

@@ -265,9 +265,9 @@ const Details = () => {
265265
}
266266
value={formData.completedOn || ''}
267267
onChange={(e) => {
268-
handleChange('completedOn', e),
269-
handleSave({ ...formData, completedOn: e });
268+
handleChange('completedOn', e);
270269
}}
270+
onBlur={() => handleSave(formData)}
271271
/>
272272
</div>
273273
</div>
@@ -281,8 +281,9 @@ const Details = () => {
281281
actionHint="Only one image can be added. Recommended resolution of 16:9 - (1280x720), (1920x1080) - Supported File Types: PNG/JPG/SVG "
282282
actionTitle={
283283
formData.logo
284-
? formData.logo.name.split('/').pop()
285-
: 'Name of the logo' }
284+
? formData.logo.name.split('/').pop()
285+
: 'Name of the logo'
286+
}
286287
/>
287288
</DropZone>
288289
</div>

0 commit comments

Comments
 (0)