Skip to content

Bug: Do not increment page when fetching is not done - #181

Merged
hansrajkvb merged 10 commits into
mainfrom
hans/fix_imodel_fetch_when_not_yet_loaded
Oct 10, 2025
Merged

Bug: Do not increment page when fetching is not done#181
hansrajkvb merged 10 commits into
mainfrom
hans/fix_imodel_fetch_when_not_yet_loaded

Conversation

@hansrajkvb

@hansrajkvb hansrajkvb commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

Bug

In the IModelGrid, when the access token or itwinid does not get loaded in time (usually on first render), no fetching occurs, but page still gets incremented.
When page gets incremented, $skip also gets incremented to ignore the first page of imodels. But in this case the fetching never happened, so the first page of imodels is never fetched.

Fix

When access token or itwinid is not yet loaded, return early so that page is not incorrectly incremented.

@hansrajkvb
hansrajkvb marked this pull request as ready for review October 10, 2025 16:51

@alexdunae alexdunae left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@hansrajkvb hansrajkvb changed the title Hans/fix imodel fetch when not yet loaded Bug: Do not increment page when fetching is not done Oct 10, 2025
@aruniverse
aruniverse requested a review from Copilot October 10, 2025 18:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug in the IModelGrid where pagination incorrectly increments when prerequisites (access token or iTwin ID) are not yet available, causing the first page of data to be skipped.

  • Added early return conditions to prevent page increment when token or context is not available
  • Added comprehensive test coverage for both missing access token and iTwin ID scenarios

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
useIModelData.ts Added status checks for TokenRequired and ContextRequired to prevent premature page incrementation
useIModelData.test.ts Added parameterized test to verify pagination behavior when prerequisites are missing
hans-fix_imodel_fetch_when_not_yet_loaded_2025-10-10-02-55.json Added changelog entry documenting the bug fix

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@hansrajkvb
hansrajkvb merged commit 64b6a9d into main Oct 10, 2025
5 of 6 checks passed
@hansrajkvb
hansrajkvb deleted the hans/fix_imodel_fetch_when_not_yet_loaded branch October 10, 2025 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants