Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.
Python aiburrchatbot-frameworkdagsgenerative-aigraphshacktoberfestllmopsllmsmlopspersistent-data-structurestate-machinestate-managementvisibility
Adds pagination to apps view page
elijahbenizzy1e865b1e198c
diff --git a/burr/cli/__main__.py b/burr/cli/__main__.pyindex b256c429..dfe600a4 100644--- a/burr/cli/__main__.py+++ b/burr/cli/__main__.py@@ -224,7 +224,8 @@ def build_and_publish(prod: bool, no_wipe_dist: bool):default="burr/tracking/server/demo_data",)@click.option("--unique-app-names", help="Use unique app names", is_flag=True)-def generate_demo_data(s3_bucket, data_dir, unique_app_names: bool):[email protected]("--no-clear-current-data", help="Don't clear current data", is_flag=True)+def generate_demo_data(s3_bucket, data_dir, unique_app_names: bool, no_clear_current_data: bool):_telemetry_if_enabled("generate_demo_data")git_root = _get_git_root()# We need to add the examples directory to the path so we have all the imports@@ -236,7 +237,8 @@ def generate_demo_data(s3_bucket, data_dir, unique_app_names: bool):if s3_bucket is None:with cd(git_root):logger.info("Removing old demo data")- shutil.rmtree(data_dir, ignore_errors=True)+ if not no_clear_current_data:+ shutil.rmtree(data_dir, ignore_errors=True)generate_all(data_dir=data_dir, unique_app_names=unique_app_names)else:generate_all(s3_bucket=s3_bucket, unique_app_names=unique_app_names)diff --git a/burr/tracking/server/backend.py b/burr/tracking/server/backend.pyindex c1f02bcb..7f7eeba0 100644--- a/burr/tracking/server/backend.py+++ b/burr/tracking/server/backend.py@@ -4,7 +4,7 @@ import importlibimport jsonimport os.pathimport sys-from typing import Any, Optional, Sequence, Type, TypeVar+from typing import Any, Optional, Sequence, Tuple, Type, TypeVarimport aiofilesimport aiofiles.os as aiofilesos@@ -101,14 +101,19 @@ class BackendBase(abc.ABC):@abc.abstractmethodasync def list_apps(- self, request: fastapi.Request, project_id: str, partition_key: Optional[str]- ) -> Sequence[schema.ApplicationSummary]:+ self,+ request: fastapi.Request,+ project_id: str,+ partition_key: Optional[str],+ limit: int,+ offset: int,+ ) -> Tuple[Sequence[schema.ApplicationSummary], int]:"""Lists out all apps (continual state machine runs with shared state) for a given project.:param request: The request object, used for authentication/authorization if needed:param project_id: filter by project id:param partition_key: filter by partition key- :return: A list of apps+ :return: A list of apps and the total number of apps (given that we paginate)"""pass@@ -230,8 +235,13 @@ class LocalBackend(BackendBase):return models.ApplicationMetadataModel()async def list_apps(- self, request: fastapi.Request, project_id: str, partition_key: Optional[str]- ) -> Sequence[ApplicationSummary]:+ self,+ request: fastapi.Request,+ project_id: str,+ partition_key: Optional[str],+ limit: int = 100,+ offset: int = 0,+ ) -> Tuple[Sequence[ApplicationSummary], int]:project_filepath = os.path.join(self.path, project_id)if not os.path.exists(project_filepath):return []@@ -265,7 +275,9 @@ class LocalBackend(BackendBase):spawning_parent_pointer=metadata.spawning_parent_pointer,))- return out+ out = sorted(out, key=lambda x: x.last_written, reverse=True)+ # TODO -- actually only get the most recent ones rather than reading everything, this is inefficient+ return out[offset : offset + limit], len(out)async def get_application_logs(self, request: fastapi.Request, project_id: str, app_id: str, partition_key: Optional[str]diff --git a/burr/tracking/server/run.py b/burr/tracking/server/run.pyindex f85a9e05..f99c4602 100644--- a/burr/tracking/server/run.py+++ b/burr/tracking/server/run.py@@ -23,7 +23,12 @@ try:from starlette.templating import Jinja2Templatesfrom burr.tracking.server import schema- from burr.tracking.server.schema import ApplicationLogs, BackendSpec, IndexingJob+ from burr.tracking.server.schema import (+ ApplicationLogs,+ ApplicationPage,+ BackendSpec,+ IndexingJob,+ )# dynamic importing due to the dashes (which make reading the examples on github easier)email_assistant = importlib.import_module("burr.examples.email-assistant.server")@@ -166,12 +171,14 @@ async def get_projects(request: Request) -> Sequence[schema.Project]:return await backend.list_projects(request)- "/api/v0/{project_id}/{partition_key}/apps", response_model=Sequence[schema.ApplicationSummary]-)[email protected]("/api/v0/{project_id}/{partition_key}/apps", response_model=ApplicationPage)async def get_apps(- request: Request, project_id: str, partition_key: str-) -> Sequence[schema.ApplicationSummary]:+ request: Request,+ project_id: str,+ partition_key: str,+ limit: int = 100,+ offset: int = 0,+) -> ApplicationPage:"""Gets all apps visible by the user:param request: FastAPI request@@ -180,7 +187,14 @@ async def get_apps("""if partition_key == SENTINEL_PARTITION_KEY:partition_key = None- return await backend.list_apps(request, project_id, partition_key=partition_key)+ applications, total_count = await backend.list_apps(+ request, project_id, partition_key=partition_key, limit=limit, offset=offset+ )+ return ApplicationPage(+ applications=list(applications),+ total=total_count,+ has_another_page=total_count > offset + limit,+ )@app.get("/api/v0/{project_id}/{app_id}/{partition_key}/apps")diff --git a/burr/tracking/server/s3/backend.py b/burr/tracking/server/s3/backend.pyindex 879d7ec7..b9467351 100644--- a/burr/tracking/server/s3/backend.py+++ b/burr/tracking/server/s3/backend.py@@ -549,7 +549,7 @@ class SQLiteS3Backend(BackendBase, IndexingBackendMixin, SnapshottingBackendMixipartition_key: Optional[str],limit: int = 100,offset: int = 0,- ) -> Sequence[schema.ApplicationSummary]:+ ) -> Tuple[Sequence[schema.ApplicationSummary], int]:# TODO -- distinctify between project name and project ID# Currently they're the same in the UI but we'll want to have them decoupledapp_query = (@@ -586,7 +586,8 @@ class SQLiteS3Backend(BackendBase, IndexingBackendMixin, SnapshottingBackendMixitags={},))- return out+ total_app_count = await app_query.count()+ return out, total_app_countasync def get_application_logs(self, request: fastapi.Request, project_id: str, app_id: str, partition_key: strdiff --git a/burr/tracking/server/schema.py b/burr/tracking/server/schema.pyindex 09057550..7bc1d30f 100644--- a/burr/tracking/server/schema.py+++ b/burr/tracking/server/schema.py@@ -41,6 +41,12 @@ class ApplicationSummary(pydantic.BaseModel):spawning_parent_pointer: Optional[PointerModel] = None+class ApplicationPage(pydantic.BaseModel):+ applications: List[ApplicationSummary]+ total: int+ has_another_page: bool++class ApplicationModelWithChildren(pydantic.BaseModel):application: ApplicationModelchildren: List[PointerModel]diff --git a/telemetry/ui/src/api/index.ts b/telemetry/ui/src/api/index.tsindex 721d334b..35b03467 100644--- a/telemetry/ui/src/api/index.ts+++ b/telemetry/ui/src/api/index.ts@@ -10,6 +10,7 @@ export type { OpenAPIConfig } from './core/OpenAPI';export type { ActionModel } from './models/ActionModel';export type { ApplicationLogs } from './models/ApplicationLogs';export type { ApplicationModel } from './models/ApplicationModel';+export type { ApplicationPage } from './models/ApplicationPage';export type { ApplicationSummary } from './models/ApplicationSummary';export type { AttributeModel } from './models/AttributeModel';export type { BackendSpec } from './models/BackendSpec';diff --git a/telemetry/ui/src/api/models/ApplicationPage.ts b/telemetry/ui/src/api/models/ApplicationPage.tsnew file mode 100644index 00000000..ebff50c0--- /dev/null+++ b/telemetry/ui/src/api/models/ApplicationPage.ts@@ -0,0 +1,10 @@+/* generated using openapi-typescript-codegen -- do no edit */+/* istanbul ignore file */+/* tslint:disable */+/* eslint-disable */+import type { ApplicationSummary } from './ApplicationSummary';+export type ApplicationPage = {+ applications: Array<ApplicationSummary>;+ total: number;+ has_another_page: boolean;+};diff --git a/telemetry/ui/src/api/services/DefaultService.ts b/telemetry/ui/src/api/services/DefaultService.tsindex a4ad5d05..2d4ff459 100644--- a/telemetry/ui/src/api/services/DefaultService.ts+++ b/telemetry/ui/src/api/services/DefaultService.ts@@ -3,7 +3,7 @@/* tslint:disable *//* eslint-disable */import type { ApplicationLogs } from '../models/ApplicationLogs';-import type { ApplicationSummary } from '../models/ApplicationSummary';+import type { ApplicationPage } from '../models/ApplicationPage';import type { BackendSpec } from '../models/BackendSpec';import type { ChatItem } from '../models/ChatItem';import type { DraftInit } from '../models/DraftInit';@@ -63,13 +63,17 @@ export class DefaultService {* :return: a list of projects visible by the user* @param projectId* @param partitionKey- * @returns ApplicationSummary Successful Response+ * @param limit+ * @param offset+ * @returns ApplicationPage Successful Response* @throws ApiError*/public static getAppsApiV0ProjectIdPartitionKeyAppsGet(projectId: string,- partitionKey: string- ): CancelablePromise<Array<ApplicationSummary>> {+ partitionKey: string,+ limit: number = 100,+ offset?: number+ ): CancelablePromise<ApplicationPage> {return __request(OpenAPI, {method: 'GET',url: '/api/v0/{project_id}/{partition_key}/apps',@@ -77,6 +81,10 @@ export class DefaultService {project_id: projectId,partition_key: partitionKey},+ query: {+ limit: limit,+ offset: offset+ },errors: {422: `Validation Error`}diff --git a/telemetry/ui/src/components/common/link.tsx b/telemetry/ui/src/components/common/link.tsxindex ed5a77d3..8ac1e951 100644--- a/telemetry/ui/src/components/common/link.tsx+++ b/telemetry/ui/src/components/common/link.tsx@@ -5,7 +5,7 @@* ensure this does what we want.*/-import { DataInteractive as HeadlessDataInteractive } from '@headlessui/react';+import { Link as RouterLink } from 'react-router-dom';import React from 'react';export const Link = React.forwardRef(function Link(@@ -13,8 +13,9 @@ export const Link = React.forwardRef(function Link(ref: React.ForwardedRef<HTMLAnchorElement>) {return (- <HeadlessDataInteractive>- <a {...props} ref={ref} />- </HeadlessDataInteractive>+ <RouterLink {...props} to={props.href} ref={ref} />+ // <HeadlessDataInteractive>+ // <a {...props} ref={ref} />+ // </HeadlessDataInteractive>);});diff --git a/telemetry/ui/src/components/common/pagination.tsx b/telemetry/ui/src/components/common/pagination.tsxnew file mode 100644index 00000000..cbcbffe3--- /dev/null+++ b/telemetry/ui/src/components/common/pagination.tsx@@ -0,0 +1,185 @@+import clsx from 'clsx';+import type React from 'react';+import { Button } from './button';++export function Pagination({+ 'aria-label': ariaLabel = 'Page navigation',+ className,+ ...props+}: React.ComponentPropsWithoutRef<'nav'>) {+ return <nav aria-label={ariaLabel} {...props} className={clsx(className, 'flex gap-x-2')} />;+}++export function PaginationPrevious({+ href = null,+ className,+ children = 'Previous'+}: React.PropsWithChildren<{ href?: string | null; className?: string }>) {+ return (+ <span className={clsx(className, 'grow basis-0')}>+ <Button {...(href === null ? { disabled: true } : { href })} plain aria-label="Previous page">+ <svg+ className="stroke-current"+ data-slot="icon"+ viewBox="0 0 16 16"+ fill="none"+ aria-hidden="true"+ >+ <path+ d="M2.75 8H13.25M2.75 8L5.25 5.5M2.75 8L5.25 10.5"+ strokeWidth={1.5}+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ {children}+ </Button>+ </span>+ );+}++export function PaginationNext({+ href = null,+ className,+ children = 'Next'+}: React.PropsWithChildren<{ href?: string | null; className?: string }>) {+ return (+ <span className={clsx(className, 'flex grow basis-0 justify-end')}>+ <Button {...(href === null ? { disabled: true } : { href })} plain aria-label="Next page">+ {children}+ <svg+ className="stroke-current"+ data-slot="icon"+ viewBox="0 0 16 16"+ fill="none"+ aria-hidden="true"+ >+ <path+ d="M13.25 8L2.75 8M13.25 8L10.75 10.5M13.25 8L10.75 5.5"+ strokeWidth={1.5}+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ </Button>+ </span>+ );+}++export function PaginationList({ className, ...props }: React.ComponentPropsWithoutRef<'span'>) {+ return <span {...props} className={clsx(className, 'hidden items-baseline gap-x-2 sm:flex')} />;+}++export function PaginationPage({+ href,+ className,+ current = false,+ children+}: React.PropsWithChildren<{ href: string; className?: string; current?: boolean }>) {+ return (+ <Button+ href={href}+ plain+ aria-label={`Page ${children}`}+ aria-current={current ? 'page' : undefined}+ className={clsx(+ className,+ 'min-w-[2.25rem] before:absolute before:-inset-px before:rounded-lg',+ current && 'before:bg-zinc-950/5 dark:before:bg-white/10'+ )}+ >+ <span className="-mx-0.5">{children}</span>+ </Button>+ );+}++export function PaginationGap({+ className,+ children = <>…</>,+ ...props+}: React.ComponentPropsWithoutRef<'span'>) {+ return (+ <span+ aria-hidden="true"+ {...props}+ className={clsx(+ className,+ 'w-[2.25rem] select-none text-center text-sm/6 font-semibold text-zinc-950 dark:text-white'+ )}+ >+ {children}+ </span>+ );+}+export const Paginator = (props: {+ currentPage: number;+ getPageURL: (page: number) => string;+ totalPages: number | undefined; // undefined if total pages is unknown+ hasNextPage: boolean;+}) => {+ const { currentPage, getPageURL, totalPages } = props;++ const renderPageNumbers = () => {+ const pages = [];++ if (totalPages !== undefined) {+ for (let page = currentPage - 2; page <= currentPage + 2; page++) {+ const classNames = page < 1 || page > totalPages ? 'invisible' : '';+ // TODO -- add pagination gap+ pages.push(+ <PaginationPage+ key={page}+ href={getPageURL(page)}+ current={page === currentPage}+ className={classNames}+ >+ {page}+ </PaginationPage>+ );+ }+ } else {+ pages.push(+ <PaginationPage key={currentPage} href={getPageURL(currentPage)} current>+ {currentPage}+ </PaginationPage>+ );++ if (currentPage > 1) {+ pages.unshift(+ <PaginationPage key={currentPage - 1} href={getPageURL(currentPage - 1)}>+ {currentPage - 1}+ </PaginationPage>+ );+ }++ if (currentPage > 2) {+ pages.unshift(+ <PaginationPage key={currentPage - 2} href={getPageURL(currentPage - 2)}>+ {currentPage - 2}+ </PaginationPage>+ );+ pages.push(<PaginationGap key="gap" />);+ }+ }++ return pages;+ };++ return (+ <Pagination className="flex flex-row justify-between bg-white w-full">+ <PaginationPrevious+ href={currentPage === 1 ? undefined : getPageURL(Math.max(1, currentPage - 1))}+ />+ <PaginationList className="w-2xl">{renderPageNumbers()}</PaginationList>+ <PaginationNext+ href={+ props.hasNextPage+ ? getPageURL(+ totalPages !== undefined ? Math.min(totalPages, currentPage + 1) : currentPage + 1+ )+ : undefined+ }+ />+ </Pagination>+ );+};diff --git a/telemetry/ui/src/components/routes/AppList.tsx b/telemetry/ui/src/components/routes/AppList.tsxindex ac8cf43c..ef6be011 100644--- a/telemetry/ui/src/components/routes/AppList.tsx+++ b/telemetry/ui/src/components/routes/AppList.tsx@@ -4,11 +4,13 @@ import { Loading } from '../common/loading';import { ApplicationSummary, DefaultService } from '../../api';import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../common/table';import { DateTimeDisplay } from '../common/dates';-import { useState } from 'react';+import { useEffect, useState } from 'react';import { FunnelIcon, MinusIcon, PlusIcon } from '@heroicons/react/24/outline';-import { Link, useNavigate } from 'react-router-dom';+import { Link, useNavigate, useSearchParams } from 'react-router-dom';import { MdForkRight } from 'react-icons/md';import { RiCornerDownRightLine } from 'react-icons/ri';+import React from 'react';+import { Paginator } from '../common/pagination';const StepCountHeader = (props: {displayZeroCount: boolean;@@ -208,64 +210,132 @@ export const AppListTable = (props: { apps: ApplicationSummary[]; projectId: str(app) => !isNullPartitionKey(app.partition_key));+ const tableRef = React.createRef<HTMLDivElement>();+ const [tableHeight, setTableHeight] = useState('auto');++ const updateTableHeight = () => {+ if (tableRef.current) {+ const parentElement = tableRef.current.parentElement;+ if (parentElement) {+ const parentHeight = parentElement.clientHeight;+ const tableTop =+ tableRef.current.getBoundingClientRect().top - parentElement.getBoundingClientRect().top;+ const availableHeight = parentHeight - tableTop;+ setTableHeight(`${availableHeight}px`);+ }+ }+ };++ useEffect(() => {+ updateTableHeight(); // Initial calculation on mount+ window.addEventListener('resize', updateTableHeight); // Recalculate on window resize++ // Set up a ResizeObserver to listen to changes in the parent element's size+ const observer = new ResizeObserver(updateTableHeight);+ if (tableRef.current?.parentElement) {+ observer.observe(tableRef.current.parentElement);+ }++ return () => {+ window.removeEventListener('resize', updateTableHeight);+ observer.disconnect(); // Cleanup observer on unmount+ };+ }, []);+return (- <Table dense={1}>- <TableHead>- <TableRow>- {anyHavePartitionKey && <TableHeader>Partition Key</TableHeader>}- <TableHeader>ID</TableHeader>- <TableHeader>Last Run</TableHeader>- <TableHeader>Forked</TableHeader>- <TableHeader>Sub Apps</TableHeader>- <TableHeader>- <StepCountHeader- displayZeroCount={displayZeroCount}- setDisplayZeroCount={setDisplayZeroCount}- />- </TableHeader>- </TableRow>- </TableHead>- <TableBody>- {rootAppsToDisplay.map((app) => {- return (- <AppSubList- key={app.app_id}- app={app}- projectId={props.projectId}- navigate={navigate}- spawningParentMap={spawningParentMap}- displayPartitionKey={anyHavePartitionKey}- />- );- })}- </TableBody>- </Table>+ <div ref={tableRef} style={{ height: tableHeight }} className="flex flex-col justify-between">+ <Table dense={1} style={{ maxHeight: tableHeight }} className="hide-scrollbar">+ <TableHead className=" bg-white sticky top-0 z-50">+ <TableRow>+ {anyHavePartitionKey && <TableHeader>Partition Key</TableHeader>}+ <TableHeader>ID</TableHeader>+ <TableHeader>Last Run</TableHeader>+ <TableHeader>Forked</TableHeader>+ <TableHeader>Sub Apps</TableHeader>+ <TableHeader>+ <StepCountHeader+ displayZeroCount={displayZeroCount}+ setDisplayZeroCount={setDisplayZeroCount}+ />+ </TableHeader>+ </TableRow>+ </TableHead>+ <TableBody>+ {rootAppsToDisplay.map((app) => {+ return (+ <AppSubList+ key={app.app_id}+ app={app}+ projectId={props.projectId}+ navigate={navigate}+ spawningParentMap={spawningParentMap}+ displayPartitionKey={anyHavePartitionKey}+ />+ );+ })}+ </TableBody>+ </Table>+ </div>);};+const DEFAULT_LIMIT = 100;+/*** List of applications. This fetches data from the BE and passes it to the table*/export const AppList = () => {const { projectId, partitionKey } = useParams();+ const [searchParams] = useSearchParams();+ const currentOffset = searchParams.get('offset') ? parseInt(searchParams.get('offset')!) : 0;+ const pageSize = DEFAULT_LIMIT;const { data, error } = useQuery(- ['apps', projectId, partitionKey],+ ['apps', projectId, partitionKey, pageSize, currentOffset],() =>DefaultService.getAppsApiV0ProjectIdPartitionKeyAppsGet(projectId as string,- partitionKey ? partitionKey : '__none__'+ partitionKey ? partitionKey : '__none__',+ pageSize,+ currentOffset),{ enabled: projectId !== undefined });++ const [queriedData, setQueriedData] = useState(data);++ useEffect(() => {+ if (data !== undefined) {+ setQueriedData(data);+ }+ }, [data]);+if (projectId === undefined) {return <Navigate to={'/projects'} />;}- if (error) return <div>Error loading projects</div>;- if (data === undefined) return <Loading />;+ if (error) return <div>Error loading apps</div>;+ const shouldDisplayPagination = queriedData ? queriedData.total > pageSize : false;return (- <div className="">- <AppListTable apps={data} projectId={projectId} />+ <div className="h-full flex flex-col gap-1 justify-between">+ {queriedData !== undefined ? (+ <AppListTable apps={queriedData.applications} projectId={projectId} />+ ) : (+ <Loading />+ )}+ <div className="flex flex-row w-full justify-center">+ {shouldDisplayPagination && (+ <Paginator+ currentPage={currentOffset / pageSize + 1}+ getPageURL={(page) => {+ // TODO -- make this more robust to URL changes+ return `/project/${projectId}/${partitionKey || '__none__'}?offset=${(page - 1) * pageSize}`;+ }}+ totalPages={queriedData ? Math.ceil(queriedData?.total / pageSize) : undefined}+ // TODO -- add query result back+ hasNextPage={queriedData ? currentOffset + pageSize < queriedData.total : false}+ ></Paginator>+ )}+ </div></div>);};diff --git a/telemetry/ui/src/components/routes/app/StepList.tsx b/telemetry/ui/src/components/routes/app/StepList.tsxindex c5caed51..7783db63 100644--- a/telemetry/ui/src/components/routes/app/StepList.tsx+++ b/telemetry/ui/src/components/routes/app/StepList.tsx@@ -1315,7 +1315,6 @@ export const StepList = (props: {)}</TableRow></TableHead>- {/* <div className="h-10"></div> */}{props.topToBottomChronological ? parentRows : <></>}<TableBody className="pt-10">{stepsWithEllapsedTime.map((step) => {diff --git a/telemetry/ui/src/examples/Common.tsx b/telemetry/ui/src/examples/Common.tsxindex dc3f4cd1..39375fd9 100644--- a/telemetry/ui/src/examples/Common.tsx+++ b/telemetry/ui/src/examples/Common.tsx@@ -60,7 +60,7 @@ export const ChatbotAppSelector = (props: {{onSuccess: (appID) => {refetch().then((data) => {- const appSummaries = data.data || [];+ const appSummaries = data.data?.applications || [];const app = appSummaries.find((app) => app.app_id === appID);if (app) {setApp(app);@@ -69,8 +69,9 @@ export const ChatbotAppSelector = (props: {}});+ const appSummaries = data?.applications || [];const appSetter = (appID: string) => createAndUpdateMutation.mutate(appID);- const dataOrEmpty = Array.from(data || []);+ const dataOrEmpty = Array.from(appSummaries || []);const options = dataOrEmpty.sort((a, b) => {return new Date(a.last_written) > new Date(b.last_written) ? -1 : 1;diff --git a/telemetry/ui/src/examples/EmailAssistant.tsx b/telemetry/ui/src/examples/EmailAssistant.tsxindex 22a4e787..42f80fce 100644--- a/telemetry/ui/src/examples/EmailAssistant.tsx+++ b/telemetry/ui/src/examples/EmailAssistant.tsx@@ -397,7 +397,7 @@ export const EmailAssistantAppSelector = (props: {{onSuccess: (appID) => {refetch().then((data) => {- const appSummaries = data.data || [];+ const appSummaries = data.data?.applications || [];const app = appSummaries.find((app) => app.app_id === appID);if (app) {setApp(app);@@ -407,7 +407,7 @@ export const EmailAssistantAppSelector = (props: {});const appSetter = (appID: string) => createAndUpdateMutation.mutate(appID);- const dataOrEmpty = Array.from(data || []);+ const dataOrEmpty = Array.from(data?.applications || []);const options = dataOrEmpty.sort((a, b) => {return new Date(a.last_written) > new Date(b.last_written) ? -1 : 1;