• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / codegate-ui / 13903674755

17 Mar 2025 03:42PM UTC coverage: 61.874% (-4.6%) from 66.452%
13903674755

Pull #345

github

web-flow
Merge ce2550358 into 5d463ef04
Pull Request #345: feat: react-hook-form field array for provider muxes

443 of 798 branches covered (55.51%)

Branch coverage included in aggregate %.

63 of 93 new or added lines in 21 files covered. (67.74%)

50 existing lines in 4 files now uncovered.

904 of 1379 relevant lines covered (65.55%)

36.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.78
/src/features/workspace/components/form-mux-context-provider.tsx
1
import { createContext, ReactNode, useContext } from 'react'
2
import { useFieldArray } from 'react-hook-form'
3
import { WorkspaceConfigFieldValues } from '../lib/schema-mux'
4

5
type FormMuxRulesContextValue = ReturnType<
6
  typeof useFieldArray<WorkspaceConfigFieldValues>
7
>
8

9
const FormMuxRulesContext = createContext<FormMuxRulesContextValue | null>(null)
4✔
10

11
export const useFormMuxRulesContext = (): FormMuxRulesContextValue => {
4✔
12
  const context = useContext(FormMuxRulesContext)
120✔
13
  if (!context)
120!
NEW
14
    throw Error(
×
15
      'useFormMuxRulesContext must be used inside a FormMuxRulesContextProvider'
16
    )
17

18
  return context
120✔
19
}
20

21
export function FormMuxRulesContextProvider({
22
  children,
23
}: {
24
  children: ReactNode
25
}) {
26
  const value = useFieldArray<WorkspaceConfigFieldValues>({
34✔
27
    name: 'muxing_rules',
28
  })
29

30
  return (
31
    <FormMuxRulesContext.Provider value={value}>
32
      {children}
33
    </FormMuxRulesContext.Provider>
34
  )
35
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc