diff --git a/packages/apps/storybook/package.json b/packages/apps/storybook/package.json index 2ee9c96c..fac28204 100644 --- a/packages/apps/storybook/package.json +++ b/packages/apps/storybook/package.json @@ -12,7 +12,7 @@ "@itwin/create-imodel-react": "^2.0.0", "@itwin/delete-imodel-react": "^2.0.0", "@itwin/delete-itwin-react": "^2.0.0", - "@itwin/imodel-browser-react": "~2.0.1", + "@itwin/imodel-browser-react": "~2.0.2", "@itwin/itwinui-react": "^2.12.18", "@itwin/manage-versions-react": "~2.0.0", "@itwin/storybook-auth-addon": "^0.1.0", diff --git a/packages/modules/imodel-browser/CHANGELOG.json b/packages/modules/imodel-browser/CHANGELOG.json index 891cfcfe..28e0ef95 100644 --- a/packages/modules/imodel-browser/CHANGELOG.json +++ b/packages/modules/imodel-browser/CHANGELOG.json @@ -1,6 +1,18 @@ { "name": "@itwin/imodel-browser-react", "entries": [ + { + "version": "2.0.2", + "tag": "@itwin/imodel-browser-react_v2.0.2", + "date": "Mon, 04 Nov 2024 21:47:34 GMT", + "comments": { + "patch": [ + { + "comment": "fix list not loading extra content when reaching the bottom" + } + ] + } + }, { "version": "2.0.1", "tag": "@itwin/imodel-browser-react_v2.0.1", diff --git a/packages/modules/imodel-browser/CHANGELOG.md b/packages/modules/imodel-browser/CHANGELOG.md index 6b1e8676..f26f9c34 100644 --- a/packages/modules/imodel-browser/CHANGELOG.md +++ b/packages/modules/imodel-browser/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log - @itwin/imodel-browser-react -This log was last generated on Mon, 16 Sep 2024 18:48:30 GMT and should not be manually modified. +This log was last generated on Mon, 04 Nov 2024 21:47:34 GMT and should not be manually modified. + +## 2.0.2 +Mon, 04 Nov 2024 21:47:34 GMT + +### Patches + +- fix list not loading extra content when reaching the bottom ## 2.0.1 Mon, 16 Sep 2024 18:48:30 GMT diff --git a/packages/modules/imodel-browser/package.json b/packages/modules/imodel-browser/package.json index 4661abc3..0251a8c8 100644 --- a/packages/modules/imodel-browser/package.json +++ b/packages/modules/imodel-browser/package.json @@ -2,7 +2,7 @@ "name": "@itwin/imodel-browser-react", "description": "Components that let the user browse the iModels of a context and select one.", "repository": "https://github.com/iTwin/admin-components-react/tree/main/packages/modules/imodel-browser", - "version": "2.0.1", + "version": "2.0.2", "main": "cjs/index.js", "module": "esm/index.js", "types": "cjs/index.d.ts", diff --git a/packages/modules/imodel-browser/src/containers/iModelGrid/IModelGrid.tsx b/packages/modules/imodel-browser/src/containers/iModelGrid/IModelGrid.tsx index 7af5e0a4..3a0b14a9 100644 --- a/packages/modules/imodel-browser/src/containers/iModelGrid/IModelGrid.tsx +++ b/packages/modules/imodel-browser/src/containers/iModelGrid/IModelGrid.tsx @@ -145,6 +145,7 @@ export const IModelGrid = ({ sortOptions: sort, searchText, maxCount, + viewMode, }); const iModels = React.useMemo( diff --git a/packages/modules/imodel-browser/src/containers/iModelGrid/useIModelData.ts b/packages/modules/imodel-browser/src/containers/iModelGrid/useIModelData.ts index 54233ff4..d92f6e69 100644 --- a/packages/modules/imodel-browser/src/containers/iModelGrid/useIModelData.ts +++ b/packages/modules/imodel-browser/src/containers/iModelGrid/useIModelData.ts @@ -2,13 +2,14 @@ * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ -import React, { useEffect, useMemo } from "react"; +import React from "react"; import { ApiOverrides, DataStatus, IModelFull, IModelSortOptions, + ViewType, } from "../../types"; import { _getAPIServer } from "../../utils/_apiOverrides"; import { useIModelSort } from "./useIModelSort"; @@ -20,6 +21,7 @@ export interface IModelDataHookOptions { apiOverrides?: ApiOverrides; searchText?: string | undefined; maxCount?: number; + viewMode?: ViewType; } const PAGE_SIZE = 100; @@ -30,6 +32,7 @@ export const useIModelData = ({ apiOverrides, searchText, maxCount, + viewMode, }: IModelDataHookOptions) => { const sortType = sortOptions?.sortType === "name" ? "name" : undefined; //Only available sort by API at the moment. const sortDescending = sortOptions?.descending; @@ -39,8 +42,9 @@ export const useIModelData = ({ const [page, setPage] = React.useState(0); const [morePages, setMorePages] = React.useState(true); const fetchMore = React.useCallback(() => { - setPage(page + 1); - }, [page]); + viewMode === "cells" && setStatus(DataStatus.Fetching); + status !== DataStatus.Fetching && setPage((page) => page + 1); + }, [status, viewMode]); React.useEffect(() => { // If sort changes but we already have all the data, @@ -103,9 +107,10 @@ export const useIModelData = ({ const searching = searchText?.trim() ? `&$search=${searchText}` : ""; const abortController = new AbortController(); - const url = `${_getAPIServer( - apiOverrides - )}/imodels/${selection}${sorting}${paging}${searching}`; + const url = `${_getAPIServer({ + data: apiOverrides?.data, + serverEnvironmentPrefix: apiOverrides?.serverEnvironmentPrefix, + })}/imodels/${selection}${sorting}${paging}${searching}`; const makeFetchRequest = async () => { const options: RequestInit = { @@ -153,7 +158,7 @@ export const useIModelData = ({ }; }, [ accessToken, - apiOverrides, + apiOverrides?.serverEnvironmentPrefix, apiOverrides?.data, morePages, page,