Skip to content

Commit

Permalink
fetch again if iModelGrid isn't full after fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
simihartstein committed Jan 8, 2025
1 parent 9f67224 commit 4515674
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,11 @@ export const IModelGrid = ({
/>
))}
{fetchMore ? (
<InView onChange={fetchMore}>
<IModelGhostTile />
<InView>
{({ inView, ref }) => {
inView && fetchStatus !== DataStatus.Fetching && fetchMore();
return <IModelGhostTile ref={ref} />;
}}
</InView>
) : null}
{fetchStatus === DataStatus.Fetching && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import { ThemeProvider, Tile } from "@itwin/itwinui-react";
import React from "react";
import React, { forwardRef } from "react";

/**
* Representation of a Ghost IModel
*/
export const IModelGhostTile = () => {
export const IModelGhostTile = forwardRef<HTMLDivElement>((props, ref) => {
return (
<ThemeProvider theme="inherit">
<ThemeProvider ref={ref} theme="inherit" {...props}>
<Tile
name={
<span
Expand All @@ -35,4 +35,4 @@ export const IModelGhostTile = () => {
/>
</ThemeProvider>
);
};
});

0 comments on commit 4515674

Please sign in to comment.