fix(blade-mcp): define missing fetchers in TreeView async example - #3891
Open
rohankokane-dev wants to merge 2 commits into
Open
fix(blade-mcp): define missing fetchers in TreeView async example#3891rohankokane-dev wants to merge 2 commits into
rohankokane-dev wants to merge 2 commits into
Conversation
The AsyncTree example called fetchCities() and fetchMoreCities() that were never defined, failing Knowledgebase Lint type-check (TS2552/TS2304) and turning master red. Add stubbed Promise<string[]> fetchers. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Contributor
|
(Review Cancelled - Superseded by a new run) |
Collaborator
🛡️ Coverage ReportSummaryFull Coverage Details |
Contributor
There was a problem hiding this comment.
✨ Agentic PR Review ✨
UI Review
⏭️ 1 skipped
Usage
import React from 'react';
import { TreeView, TreeViewItem, TreeViewLoadMore } from '@razorpay/blade/components';
// Async children: fetch on first expand, then progressively load more
function AsyncTree() {
const [cities, setCities] = React.useState<string[]>([]);
const [isLoadingChildren, setIsLoadingChildren] = React.useState(false);
const [isLoadingMore, setIsLoadingMore] = React.useState(false);
const [hasMore, setHasMore] = React.useState(true);
const fetchCities = (): Promise<string[]> =>
Promise.resolve(['Bengaluru', 'Mysuru']);
const fetchMoreCities = (): Promise<string[]> =>
Promise.resolve(['Hubli', 'Mangaluru']);
return (
<TreeView selectionType="multiple">
<TreeViewItem
title="Karnataka"
value="karnataka"
hasChildren
isLoading={isLoadingChildren}
onExpandChange={({ isExpanded }) => {
if (isExpanded && cities.length === 0) {
setIsLoadingChildren(true);
fetchCities()
.then((loaded) => {
setCities(loaded);
setIsLoadingChildren(false);
})
.catch(() => setIsLoadingChildren(false));
}
}}
>
{cities.map((city) => (
<TreeViewItem key={city} title={city} value={city.toLowerCase()} />
))}
{hasMore ? (
<TreeViewLoadMore
isLoading={isLoadingMore}
onClick={() => {
setIsLoadingMore(true);
fetchMoreCities()
.then((more) => {
setCities((prev) => [...prev, ...more]);
setHasMore(false);
setIsLoadingMore(false);
})
.catch(() => setIsLoadingMore(false));
}}
/>
) : null}
</TreeViewItem>
<TreeViewItem title="Goa" value="goa" />
</TreeView>
);
}…olved by agent] Co-authored-by: admin <admin>
Contributor
|
🤖 Slash AI Review has been triggered. View execution logs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The AsyncTree example called fetchCities() and fetchMoreCities() that were never defined, failing Knowledgebase Lint type-check (TS2552/TS2304) and turning master red. Add stubbed Promise<string[]> fetchers.
Description
Changes
Additional Information
Component Checklist