File size: 613 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { createContext } from 'react';

import type { InstantSearch, UiState } from 'instantsearch.js';

export type InstantSearchServerContextApi<
  TUiState extends UiState,
  TRouteState = TUiState
> = {
  /**
   * Fowards search internals to the server execution context to access them
   * in `getServerState()`.
   */
  notifyServer(params: { search: InstantSearch<TUiState, TRouteState> }): void;
};

export const InstantSearchServerContext =
  createContext<InstantSearchServerContextApi<UiState, UiState> | null>(null);

if (__DEV__) {
  InstantSearchServerContext.displayName = 'InstantSearchServer';
}