| 21 | } |
| 22 | |
| 23 | interface SSREffectOptions<Payload> { |
| 24 | /** |
| 25 | * Function used to get effect payload. |
| 26 | * |
| 27 | * if SKIP_SYMBOL returned(`return skip()`), effect won't get dispatched when SSR |
| 28 | * |
| 29 | * @param req express request object |
| 30 | * @param skip get a symbol used to let effect escape from ssr effects dispatching |
| 31 | */ |
| 32 | payloadGetter?: ( |
| 33 | req: Request, |
| 34 | skip: () => typeof SKIP_SYMBOL, |
| 35 | ) => Payload | Promise<Payload> | typeof SKIP_SYMBOL |
| 36 | |
| 37 | /** |
| 38 | * Whether skip first effect dispatching in client if effect ever got dispatched when SSR |
| 39 | * |
| 40 | * @default true |
| 41 | */ |
| 42 | skipFirstClientDispatch?: boolean |
| 43 | } |
| 44 | |
| 45 | // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types |
| 46 | export function SSREffect<T, Payload>(options?: SSREffectOptions<Payload>) { |
nothing calls this directly
no outgoing calls
no test coverage detected