Refactor components to enhance code clarity and maintainability by updating prop types to use Readonly for better immutability. Adjust Result class methods for consistency, and streamline query functions in ChannelDetail and other components to improve performance and readability.
This commit is contained in:
@@ -16,10 +16,10 @@ import { formatClock } from './format'
|
||||
export function BlockBuilder({
|
||||
onSaved,
|
||||
onError,
|
||||
}: {
|
||||
}: Readonly<{
|
||||
onSaved: () => void
|
||||
onError: (error: unknown) => void
|
||||
}) {
|
||||
}>) {
|
||||
const { t } = useTranslation()
|
||||
const [name, setName] = useState('')
|
||||
const [items, setItems] = useState<ClipDragItem[]>([])
|
||||
|
||||
@@ -15,7 +15,7 @@ import { formatClock } from './format'
|
||||
* Группы роликов собираются здесь же, а не в общем редакторе групп (см. 6.7): в выбранную группу
|
||||
* перетаскиваются и отдельные ролики, и готовые блоки — стык умеет и то и другое.
|
||||
*/
|
||||
export function ClipGroupPanel({ onError }: { onError: (error: unknown) => void }) {
|
||||
export function ClipGroupPanel({ onError }: Readonly<{ onError: (error: unknown) => void }>) {
|
||||
const { t } = useTranslation()
|
||||
const queryClient = useQueryClient()
|
||||
const [selected, setSelected] = useState('')
|
||||
|
||||
@@ -48,7 +48,7 @@ export function InterstitialsPanel() {
|
||||
const onError = useApiError()
|
||||
|
||||
const renameMutation = useMutation({
|
||||
mutationFn: ({ id, name }: { id: string; name: string }) => renameShow(id, name),
|
||||
mutationFn: ({ id, name }: Readonly<{ id: string; name: string }>) => renameShow(id, name),
|
||||
onSuccess: () => {
|
||||
setRenaming(null)
|
||||
invalidate()
|
||||
|
||||
Reference in New Issue
Block a user