Skip to content

Commit

Permalink
fix: Fixed single-select Cascader, under React18, the expansion behav…
Browse files Browse the repository at this point in the history
…ior is abnormal when loading data asynchronously
  • Loading branch information
YyumeiZhang committed Aug 21, 2024
1 parent d394a91 commit a84151e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/semi-ui/cascader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,11 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
if (loadData) {
new Promise<void>(resolve => {
loadData(selectedOpt).then(() => {
callback();
this.setState({ loading: false });
resolve();
setTimeout(() => {
callback();
this.setState({ loading: false });
resolve();
})
});
});
}
Expand Down

0 comments on commit a84151e

Please sign in to comment.