(props: { initialSearch?: string })
| 2036 | } |
| 2037 | |
| 2038 | const MutationDetails = (props: { initialSearch?: string }) => { |
| 2039 | const { selectedMutationId } = useDevtoolsState() |
| 2040 | |
| 2041 | const theme = useTheme() |
| 2042 | const themed = createThemed(theme) |
| 2043 | |
| 2044 | const isPaused = createSubscribeToMutationCacheBatcher((mutationCache) => { |
| 2045 | const mutations = mutationCache().getAll() |
| 2046 | const mutation = mutations.find( |
| 2047 | (m) => m.mutationId === selectedMutationId(), |
| 2048 | ) |
| 2049 | if (!mutation) return false |
| 2050 | return mutation.state.isPaused |
| 2051 | }) |
| 2052 | |
| 2053 | const status = createSubscribeToMutationCacheBatcher((mutationCache) => { |
| 2054 | const mutations = mutationCache().getAll() |
| 2055 | const mutation = mutations.find( |
| 2056 | (m) => m.mutationId === selectedMutationId(), |
| 2057 | ) |
| 2058 | if (!mutation) return 'idle' |
| 2059 | return mutation.state.status |
| 2060 | }) |
| 2061 | |
| 2062 | const color = createMemo(() => |
| 2063 | getMutationStatusColor({ |
| 2064 | isPaused: isPaused(), |
| 2065 | status: status(), |
| 2066 | }), |
| 2067 | ) |
| 2068 | |
| 2069 | const activeMutation = createSubscribeToMutationCacheBatcher( |
| 2070 | (mutationCache) => |
| 2071 | mutationCache() |
| 2072 | .getAll() |
| 2073 | .find((mutation) => mutation.mutationId === selectedMutationId()), |
| 2074 | false, |
| 2075 | ) |
| 2076 | |
| 2077 | const matchingSearch = (value: unknown) => |
| 2078 | props.initialSearch && matchesData(value, props.initialSearch.toLowerCase()) |
| 2079 | ? props.initialSearch |
| 2080 | : undefined |
| 2081 | |
| 2082 | return ( |
| 2083 | <Show when={activeMutation()}> |
| 2084 | <div |
| 2085 | class={`${themed('tsqd-style-details-container')} tsqd-query-details-container`} |
| 2086 | > |
| 2087 | <div |
| 2088 | role="heading" |
| 2089 | aria-level="2" |
| 2090 | class={`${themed('tsqd-style-details-header')} tsqd-query-details-header`} |
| 2091 | > |
| 2092 | Mutation Details |
| 2093 | </div> |
| 2094 | <div class="tsqd-style-details-body tsqd-query-details-summary-container"> |
| 2095 | <div class="tsqd-query-details-summary"> |
nothing calls this directly
no test coverage detected