(input: Input)
| 136 | }, |
| 137 | |
| 138 | read(input: Input): Value { |
| 139 | // Prevent access outside of render. |
| 140 | readContext(CacheContext); |
| 141 | |
| 142 | const key = hashInput(input); |
| 143 | const result: Thenable<Value> = accessResult(resource, fetch, input, key); |
| 144 | if (typeof React.use === 'function') { |
| 145 | // eslint-disable-next-line react-hooks-published/rules-of-hooks |
| 146 | return React.use(result); |
| 147 | } |
| 148 | |
| 149 | switch (result.status) { |
| 150 | case 'fulfilled': { |
| 151 | const value = result.value; |
| 152 | return value; |
| 153 | } |
| 154 | case 'rejected': { |
| 155 | const error = result.reason; |
| 156 | throw error; |
| 157 | } |
| 158 | default: |
| 159 | throw result; |
| 160 | } |
| 161 | }, |
| 162 | |
| 163 | preload(input: Input): void { |
| 164 | // Prevent access outside of render. |
no test coverage detected