mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-28 21:42:27 +08:00
refactor(video): extract size update logic into separate callback
Improve code maintainability by separating size update logic into its own useCallback hook
This commit is contained in:
parent
1fd7b0b667
commit
9997188f5e
@ -30,6 +30,13 @@ export const OpenAIParamSettings = ({ params, updateParams }: OpenAIParamSetting
|
||||
[updateParams]
|
||||
)
|
||||
|
||||
const updateSize = useCallback(
|
||||
(size: VideoSize) => {
|
||||
updateParams({ params: { size } })
|
||||
},
|
||||
[updateParams]
|
||||
)
|
||||
|
||||
return (
|
||||
<SettingsGroup>
|
||||
<SettingItem>
|
||||
@ -56,7 +63,7 @@ export const OpenAIParamSettings = ({ params, updateParams }: OpenAIParamSetting
|
||||
labelPlacement="outside"
|
||||
selectedKeys={[params.params.size ?? '720x1280']}
|
||||
onSelectionChange={(keys) => {
|
||||
if (keys.currentKey) updateParams({ params: { size: keys.currentKey as VideoSize } })
|
||||
if (keys.currentKey) updateSize(keys.currentKey as VideoSize)
|
||||
}}
|
||||
items={sizeItems}
|
||||
selectionMode="single"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user