()
| 102 | > |
| 103 | |
| 104 | constructor() { |
| 105 | super() |
| 106 | |
| 107 | this.projectsQueryOptions = { |
| 108 | queryKey: projectsQueryKey(this.page, this.delayMs, this.forceErrorMode), |
| 109 | queryFn: () => |
| 110 | fetchProjectsPage(this.page, this.delayMs, this.forceErrorMode), |
| 111 | placeholderData: keepPreviousData, |
| 112 | } |
| 113 | |
| 114 | this.projectsQuery = createQueryController<ProjectsPageResponse, Error>( |
| 115 | this, |
| 116 | this.projectsQueryOptions, |
| 117 | ) |
| 118 | |
| 119 | this.createProjectMutation = createMutationController< |
| 120 | Project, |
| 121 | Error, |
| 122 | CreateProjectInput |
| 123 | >( |
| 124 | this, |
| 125 | { |
| 126 | mutationKey: ['create-project'], |
| 127 | mutationFn: async (input) => { |
| 128 | const response = await createProjectOnServer(input) |
| 129 | return response.project |
| 130 | }, |
| 131 | onMutate: () => { |
| 132 | this.mutationControlStatus = 'idle' |
| 133 | this.mutationControlError = undefined |
| 134 | }, |
| 135 | onSuccess: async () => { |
| 136 | this.page = 1 |
| 137 | this.lastAutoPrefetchPage = 0 |
| 138 | this.prefetchStatus = 'idle' |
| 139 | this.draftName = '' |
| 140 | this.draftOwner = 'Team 6' |
| 141 | this.syncProjectsQueryOptions() |
| 142 | await queryClient.invalidateQueries({ |
| 143 | queryKey: ['projects'], |
| 144 | refetchType: 'none', |
| 145 | }) |
| 146 | await this.projectsQuery.refetch() |
| 147 | }, |
| 148 | }, |
| 149 | queryClient, |
| 150 | ) |
| 151 | |
| 152 | this.favoriteMutation = createMutationController< |
| 153 | Project, |
| 154 | Error, |
| 155 | ToggleProjectFavoriteInput, |
| 156 | FavoriteMutationContext |
| 157 | >( |
| 158 | this, |
| 159 | { |
| 160 | mutationKey: ['toggle-project-favorite'], |
| 161 | mutationFn: async (input) => { |
nothing calls this directly
no test coverage detected