> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Hooks

## useActivePageKeyFromUrl

Hook returning the active dashboard page key from the URL, if any. Defaults to the first page specified in the dashboard state.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useActivePageKeyFromUrl();
```

**Returns:**

string | undefined

## useActivity

React hook returning:

* the value for the given activity key

* a function to update this value

* whether the activity is loading

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useActivity(key);
```

| Argument | Type | Description |
| :- | :- | :- |
| key | T | |

**Returns:**

\[[Activity](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#activity)\[T] | null, (value: [Activity](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#activity)\[T]) => void, \{ isLoading: boolean; }]

## useAtotiClient

React hook returning the [AtotiClient](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#atoticlient) at `serverKey`.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useAtotiClient(serverKey);
```

| Argument | Type | Description |
| :- | :- | :- |
| serverKey | string \| undefined | |

**Returns:**

[AtotiClient](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#atoticlient) | undefined

**Throws:**

[ClientsNotFoundError](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/errors.md#clientsnotfounderror) when no clients are provided via [ClientsProvider](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/context-providers.md#clientsprovider).

[AtotiClientNotFoundError](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/errors.md#atoticlientnotfounderror) when `serverKey` is defined but no [AtotiClient](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#atoticlient) is provided for this key via [ClientsProvider](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/context-providers.md#clientsprovider).

## useAtotiClients

React hook returning the map of all registered [AtotiClient](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#atoticlient)s.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useAtotiClients();
```

**Returns:**

\{ \[serverKey: string]: [AtotiClient](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#atoticlient); }

## useConnectionStatuses

React hook returning the overall status of the connection with the registered Atoti clients.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useConnectionStatuses();
```

**Returns:**

\{ \[serverKey: string]: [ConnectionStatus](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#connectionstatus); }

## useContentClient

React hook returning the [ContentClient](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#contentclient).

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useContentClient(options);
```

| Argument | Type | Description |
| :- | :- | :- |
| options | \{    throwIfMissing: boolean; } | |

**Returns:**

[ContentClient](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#contentclient)\<Settings> | undefined

**Throws:**

[ClientsNotFoundError](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/errors.md#clientsnotfounderror) when no clients are provided via [ClientsProvider](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/context-providers.md#clientsprovider), unless `throwIfMissing` is set to false.

[ContentClientNotFoundError](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/errors.md#contentclientnotfounderror) when no [ContentClient](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#contentclient) is provided via [ClientsProvider](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/context-providers.md#clientsprovider), unless `throwIfMissing` is set to false.

## useCube

React hook returning the cube targeted by the given `widgetState`, along with its data model and server key. Defaults `serverKey` to the key of the first provided server, when `widgetState.serverKey` is not defined. Defaults `cube` to the first cube of the target server, when `widgetState.query.mdx` does not include a cube name and no `widgetState.initialCubeName` is defined. When `throwIfMissing` is set to false, returns `undefined` instead of throwing while the target server or cube is not available yet, e.g. while its data model is still loading.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useCube(widgetState, options);
```

| Argument | Type | Description |
| :- | :- | :- |
| widgetState | T \| undefined | |
| options | \{    throwIfMissing: boolean; } | |

**Returns:**

TargetCube | undefined

**Throws:**

* [DataModelNotFoundError](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/errors.md#datamodelnotfounderror) if the data model is not loaded yet, unless `throwIfMissing` is set to false. - [CubeNotFoundError](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/errors.md#cubenotfounderror) if the data model does not contain any cube with the specified name, unless `throwIfMissing` is set to false. - [EmptyDataModelError](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/errors.md#emptydatamodelerror) if the data model was loaded but does not contain any cube.

## useDataModel

React hook returning the [DataModel](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#datamodel) of the Atoti server identified by `serverKey`.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useDataModel(serverKey);
```

| Argument | Type | Description |
| :- | :- | :- |
| serverKey | string \| undefined | |

**Returns:**

[DataModel](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#datamodel) | undefined

**Throws:**

[DataModelNotFoundError](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/errors.md#datamodelnotfounderror) when `serverKey` is defined but the data model could not be found.

## useDataModels

React hook returning the data models of all Atoti servers to which the client is connected. When `includeLoadingAndErroredDataModels` is true, also includes unreachable servers as errored.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useDataModels(options);
```

If "options.includeLoadingAndErroredDataModels" is set to false, only the successfully loaded data models will be returned.

| Argument | Type | Description |
| :- | :- | :- |
| options | \{    includeLoadingAndErroredDataModels: true; } | |

**Returns:**

DataModels\<true>

## useIsModalMounted

Hook returning whether a modal should be mounted/unmounted depending on whether it is visible. It allows to reset the state of a Modal declaratively, without losing Ant Design's close animation.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useIsModalMounted(isModalVisible);
```

| Argument | Type | Description |
| :- | :- | :- |
| isModalVisible | boolean | |

**Returns:**

boolean

**For example:**

```
const ModalParent = () => {
  const [isModalVisible, setIsModalVisible] = useState(false);
  const isModalMounted = useIsModalMounted(isModalVisible);
  const handleModalClosed = () => {setIsModalVisible(false);};
  return isModalMounted &&
     <Modal
         isVisible={isModalVisible}
         onSubmit={handleModalClosed}
         onCancel={handleModalClosed}
      >
         <ModalChildren />
     </Modal>
}
```

## useIsPresenting

React hook returning the current state of isPresenting.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useIsPresenting();
```

**Returns:**

boolean

## useJwt

React hook returning the JWT allowing to authenticate the communication with the servers.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useJwt();
```

**Returns:**

string

## useLogout

React hook returning a callback to logout the user.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useLogout();
```

**Returns:**

(() => Promise\<void>) | null

## useMenuItemCreateFolder

React hook returning a menu item to create a folder.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useMenuItemCreateFolder(props);
```

| Argument | Type | Description |
| :- | :- | :- |
| props | [FileListMenuItemProps](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#filelistmenuitemprops) | |

**Returns:**

MenuItemType | null

## useMenuItemDeleteFilesAndFolders

React hook returning a menu item to delete several files and folders.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useMenuItemDeleteFilesAndFolders(props);
```

| Argument | Type | Description |
| :- | :- | :- |
| props | [FileListMenuItemProps](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#filelistmenuitemprops) | |

**Returns:**

MenuItemType | null

## useMenuItemExportFilesAndFolders

React hook returning a menu item to export the content of a file, a folder or a combination of files and folders.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useMenuItemExportFilesAndFolders(props);
```

| Argument | Type | Description |
| :- | :- | :- |
| props | [FileListMenuItemProps](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#filelistmenuitemprops) | |

**Returns:**

MenuItemType | null

## useMenuItemImportFilesAndFolders

React hook returning a menu item to import a file, a folder, or a combination of files and folders into another folder.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useMenuItemImportFilesAndFolders(props);
```

| Argument | Type | Description |
| :- | :- | :- |
| props | [FileListMenuItemProps](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#filelistmenuitemprops) | |

**Returns:**

MenuItemType | null

## useMenuItemMakeCopyOfFile

React hook returning a menu item to make a copy of a file.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useMenuItemMakeCopyOfFile(props);
```

| Argument | Type | Description |
| :- | :- | :- |
| props | [FileListMenuItemProps](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#filelistmenuitemprops) | |

**Returns:**

MenuItemType | null

## useMenuItemMoveFilesAndFolders

React hook returning a menu item to move files and folders into a folder.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useMenuItemMoveFilesAndFolders({
  onAfterSubmit,
  selectedFilesAndFolders: selectedFilesAndFoldersOrServer,
  pathToParentFolder,
  contentTree,
  contentType,
});
```

| Argument | Type | Description |
| :- | :- | :- |
| \{    onAfterSubmit,    selectedFilesAndFolders: selectedFilesAndFoldersOrServer,    pathToParentFolder,    contentTree,    contentType, } | [FileListMenuItemProps](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#filelistmenuitemprops) | |

**Returns:**

MenuItemType | null

## useMenuItemRenameFileOrFolder

React hook returning a menu item to rename a folder or a file.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useMenuItemRenameFileOrFolder(props);
```

| Argument | Type | Description |
| :- | :- | :- |
| props | [FileListMenuItemProps](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#filelistmenuitemprops) | |

**Returns:**

MenuItemType | null

## useMenuItemShareFileOrFolder

React hook returning a menu item to edit permissions for the underlying file or folder.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useMenuItemShareFileOrFolder({
  selectedFilesAndFolders,
  pathToParentFolder,
  contentType,
});
```

| Argument | Type | Description |
| :- | :- | :- |
| \{    selectedFilesAndFolders,    pathToParentFolder,    contentType, } | [FileListMenuItemProps](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#filelistmenuitemprops) | |

**Returns:**

MenuItemType | null

## useModal

React hook returning functions to open a modal, and close the active modal. The functions are provided by a [ModalsProvider](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/context-providers.md#modalsprovider).

Note: in most cases, you do **not** need this API, and you can use a regular declarative [\<Modal />](https://ant.design/components/modal). This imperative API is useful when the modal lifecycle needs to be decoupled from that of its trigger, for example when opening a modal through a context menu item.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useModal();
```

**Returns:**

\{ openModal: \{ \<PropsType extends object>(modalKey: string, initialProps: PropsType): void; (modalKey: string): void; }; closeModal: () => void; }

## useOnDataModelClicked

React hook accepting a listener on data model tree clicks. Calls this listener each time a node is clicked in the data model tree.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useOnDataModelClicked(listener);
```

| Argument | Type | Description |
| :- | :- | :- |
| listener | [DataModelClickListener](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#datamodelclicklistener) | |

**Returns:**

void

## useOnDataModelNodeClickedForDataVisualizationWidget

React hook allowing to add fields onto a data visualization widget. To be used on a [WidgetPlugin](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#widgetplugin).

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useOnDataModelNodeClickedForDataVisualizationWidget(widgetState);
```

| Argument | Type | Description |
| :- | :- | :- |
| widgetState | WidgetState | |

**Returns:**

(node: [DataModelNode](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#datamodelnode)) => WidgetState

## usePermission

React hook returning:

* the permission value for the given key

* a function to update this permission when authenticated as a user with admin privileges

* an object indicating whether the permissions are loading and whether the permission has explicitly been set

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
usePermission(key);
```

| Argument | Type | Description |
| :- | :- | :- |
| key | T | |

**Returns:**

\[ [Permissions](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#permissions)\[T], (value: [Permissions](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#permissions)\[T]) => Promise\<void>, \{ isLoading: boolean; isSet: boolean; } ]

## usePersisted

React hook returning the value for the `key` in the browser local storage and the function to update it.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
usePersisted(key, initialValue);
```

| Argument | Type | Description |
| :- | :- | :- |
| key | string | |
| initialValue | T | |

**Returns:**

\[T | undefined, (newValue: T) => void]

## usePositionInDashboard

Returns the [PositionInDashboard](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#positionindashboard) of the widget in the dashboard.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
usePositionInDashboard();
```

**Returns:**

[PositionInDashboard](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#positionindashboard) | null

## useQuery

React hook returning the up-to-date [Query](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#query) corresponding to `queryId`.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useQuery({
  serverKey,
  queryId,
});
```

| Argument | Type | Description |
| :- | :- | :- |
| \{    serverKey,    queryId, } | \{    serverKey?: string;    queryId?: string; } | |

**Returns:**

[Query](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#query)\<[MdxString](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#mdxstring)> | undefined

## useQueryResult

React hook allowing to subscribe to a query's result. If `query` is provided, also runs the query.

`serverKey` identifies which server to run the query against. `queryId` identifies the query. `query` is the MDX that indicates which data to retrieve from Atoti Server. This data is displayed in the widget.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useQueryResult({
  serverKey,
  queryId,
  query,
});
```

| Argument | Type | Description |
| :- | :- | :- |
| \{    serverKey,    queryId,    query, } | \{    serverKey?: string;    queryId?: string;    query?: [Query](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#query)\<[MdxString](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#mdxstring)>; } | |

**Returns:**

[QueryResult](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#queryresult)\<ResultType>

**Remarks:**

If `queryId` is not provided, the subscription is canceled and an empty result is returned.

## useRequestInit

Returns the requestInit from the React context.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useRequestInit();
```

**Returns:**

RequestInit

## useSetting

React hook returning the value of a setting that may have no registered definition, such as one that an extension registers. Without a definition, the setting defaults to `fallbackValue`. It also returns a function to update this setting, and whether the settings are loading.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useSetting(key, options);
```

| Argument | Type | Description |
| :- | :- | :- |
| key | string | |
| options | \{    fallbackValue: Value; } | |

**Returns:**

\[Value, (newValue: Value) => Promise\<void>, \{ isLoading: boolean; }]

## useSwitchedWidgetState

React Hook returning the switched widget state if switched or the original state if not switched.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useSwitchedWidgetState(widgetState, queryId);
```

| Argument | Type | Description |
| :- | :- | :- |
| widgetState | WidgetState | |
| queryId | string | |

**Returns:**

WidgetState

## useTheme

React hook returning the [Theme](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#theme).

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useTheme();
```

**Returns:**

[Theme](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#theme)

## useTree

React hook returning the dashboards or widgets tree.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useTree(type, options);
```

| Argument | Type | Description |
| :- | :- | :- |
| type | T | |
| options | \{    throwIfContentClientMissing: boolean; } | |

**Returns:**

[ContentRecord](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#contentrecord)\<[DashboardMetaData](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#dashboardmetadata) | [WidgetMetaData](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#widgetmetadata) | [FilterMetaData](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#filtermetadata)> | null

**Throws:**

[ContentClientNotFoundError](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/errors.md#contentclientnotfounderror) when no [ContentClient](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#contentclient) is provided via [ClientsProvider](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/context-providers.md#clientsprovider), unless `throwIfContentClientMissing` is set to false.

## useUser

React hook returning the [User](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#user).

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useUser(options);
```

| Argument | Type | Description |
| :- | :- | :- |
| options | \{    throwIfMissing: boolean; } | |

**Returns:**

[User](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#user) | undefined

**Throws:**

[UserNotFoundError](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/errors.md#usernotfounderror) when no [User](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#user) is provided via [UserProvider](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/context-providers.md#userprovider), unless `throwIfMissing` is set to false.

## useUserNames

React hook returning the provided usernames from context.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useUserNames();
```

**Returns:**

[UserName](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#username)\[] | null

## useUserRoles

React hook returning the user roles from context.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useUserRoles();
```

**Returns:**

[UserRole](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#userrole)\[] | null

## useWebsocketHeaders

React hook returning the headers to be set on "REGISTER" and "UPDATE" websocket messages.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useWebsocketHeaders();
```

**Returns:**

Record\<string, string> | undefined

## useWidgetName

React Hook returning either widgetState.name if defined otherwise returns a translated initial name from the widget plugin.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useWidgetName(widgetState);
```

| Argument | Type | Description |
| :- | :- | :- |
| widgetState | [AWidgetState](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#awidgetstate) | |

**Returns:**

string

## useWidgetPluginKeys

React hook returning the keys of all the registered widget plugins.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useWidgetPluginKeys();
```

**Returns:**

string\[]

## useWidgetPlugins

React hook returning the widget plugins corresponding to `widgetKeys`.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useWidgetPlugins(widgetKeys);
```

| Argument | Type | Description |
| :- | :- | :- |
| widgetKeys | string\[] | |

**Returns:**

[WidgetPlugin](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#widgetplugin)\[]

## useWidgetQueryResult

React hook running the widget's [Query](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#query), impacted by the user/dashboard/page filters and query contexts, and returning its result. When the widget is in an inactive dashboard page or deferred updates are enabled: - The query is paused if it was in real-time mode. - Updates to the query on the client side are not forwarded to the server.

```typescript theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
useWidgetQueryResult({
  serverKey,
  queryId,
  widgetState,
  dashboardState,
  pageKey,
  cube,
  queryRanges,
  isDeferred,
});
```

| Argument | Type | Description |
| :- | :- | :- |
| \{    serverKey,    queryId,    widgetState,    dashboardState,    pageKey,    cube,    queryRanges,    isDeferred, } | \{    serverKey?: string;    queryId?: string;    widgetState: [WidgetWithQueryState](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#widgetwithquerystate)\<MdxType>;    dashboardState?: [DashboardState](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#dashboardstate);    pageKey?: string;    cube: [Cube](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#cube);    queryRanges?: Partial\<\{      \[axisId in [AxisId](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#axisid)]: [QueryRange](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#queryrange);   }>;    isDeferred?: boolean; } | |

**Returns:**

[QueryResult](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#queryresult)\<MdxType extends [MdxSelect](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#mdxselect) ? [CellSet](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#cellset) : [DrillthroughResult](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/developer-guide/reference/types.md#drillthroughresult)>
