Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Drawer add loading prop to show spinner #48563

Merged
merged 6 commits into from Apr 29, 2024

Conversation

Enigama
Copy link
Contributor

@Enigama Enigama commented Apr 20, 2024

中文版模板 / Chinese template

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

It would be nice to have loading prop, it will solve some issue when async data loads in drawer and we don't want to show drawer without title or some body parts.

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

Copy link

stackblitz bot commented Apr 20, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Contributor

github-actions bot commented Apr 20, 2024

Preview is ready

Copy link
Contributor

github-actions bot commented Apr 20, 2024

👁 Visual Regression Report for PR #48563 Failed ❌

🎯 Target branch: feature (ba5f9fe)
📖 View Full Report ↗︎

Expected (Branch feature) Actual (Current PR) Diff
drawer-loading.compact.css-var.png drawer-loading.compact.css-var.png 🆕🆕🆕 Added 🆕🆕🆕
drawer-loading.compact.png drawer-loading.compact.png 🆕🆕🆕 Added 🆕🆕🆕
drawer-loading.dark.css-var.png drawer-loading.dark.css-var.png 🆕🆕🆕 Added 🆕🆕🆕
drawer-loading.dark.png drawer-loading.dark.png 🆕🆕🆕 Added 🆕🆕🆕
drawer-loading.default.css-var.png drawer-loading.default.css-var.png 🆕🆕🆕 Added 🆕🆕🆕
drawer-loading.default.png drawer-loading.default.png 🆕🆕🆕 Added 🆕🆕🆕

Check Full Report for details

Copy link

codesandbox-ci bot commented Apr 20, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@Enigama
Copy link
Contributor Author

Enigama commented Apr 20, 2024

@yoyo837 @afc163

@Enigama
Copy link
Contributor Author

Enigama commented Apr 20, 2024

@yoyo837 @afc163 I think over comment that we should prevent to show drawer content while loading here is my thought how to do it, maybe you have some suggestion?

if (spinProps?.spinning) {
    return (
      <Spin
        spinning={false}
        style={{
          height: '100%',
          display: 'flex',
          justifyContent: 'center',
          alignItems: 'center',
        }}
        {...spinProps}
      />
    );
  }

  return (
    <>
      {headerNode}
      <div
        className={classNames(
          `${prefixCls}-body`,
          drawerClassNames?.body,
          drawerContext?.classNames?.body,
        )}
        style={{
          ...drawerContext?.styles?.body,
          ...bodyStyle,
          ...drawerStyles?.body,
        }}
      >
        {children}
      </div>
      {footerNode}
    </>
  );

However when I tried to run this example I came up with warning for tip property since it could be only for full screen or nested spin which is not our case. So I have to Omit tip prop as well as i did for full screen

@Enigama
Copy link
Contributor Author

Enigama commented Apr 21, 2024

@yoyo837 @afc163 @zombieJ what your thoughts?

@Enigama
Copy link
Contributor Author

Enigama commented Apr 22, 2024

Is it ok that regression and tests are failed?

@afc163
Copy link
Member

afc163 commented Apr 23, 2024

@Enigama Enigama requested a review from yoyo837 April 23, 2024 17:31
@Enigama
Copy link
Contributor Author

Enigama commented Apr 24, 2024

Irrelevant.
@yoyo837 @afc163 I see that ci failed on demo-extend.test.tsx which use original rc-drawer where we do not have loading statement and there fore snapshot has differences, what should i do, add conditional rendering in rc-drawer as well as we have in ant-drawer?
Like:
image
image

@Enigama
Copy link
Contributor Author

Enigama commented Apr 24, 2024

Irrelevant.
@yoyo837 @afc163 Should I add loading to original component rc-drawer because I think it would fix test?

Copy link
Contributor

Hi @Enigama. Thanks for your contribution. The path .github/ or scripts/ and CHANGELOG is only maintained by team members. This current PR will be closed and team members will help on this.

@Enigama
Copy link
Contributor Author

Enigama commented Apr 25, 2024

😭

@Enigama
Copy link
Contributor Author

Enigama commented Apr 25, 2024

I've done the command: npm run test:site-update which was suggested by the failed e2e test in gh action, did I something wrong? Should I reopen pr but without check-site.ts.snap updates?

@Enigama
Copy link
Contributor Author

Enigama commented Apr 25, 2024

@MadCcc @afc163 @yoyo837 @zombieJ what should I do?

Copy link

codecov bot commented Apr 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (ba5f9fe) to head (6a92483).

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #48563   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          745       745           
  Lines        12981     12987    +6     
  Branches      3403      3406    +3     
=========================================
+ Hits         12981     12987    +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Enigama
Copy link
Contributor Author

Enigama commented Apr 26, 2024

@MadCcc @afc163 @yoyo837 @zombieJ I see that check test / test (18, dom, 1/2) (pull_request) has failed but it doesn't concern to my changes(I guess), can you guys check the RP and if it's fine than approve it, if it's not, please give me detailed message it would help me to fix it a way more faster. Thanks.

@yoyo837
Copy link
Contributor

yoyo837 commented Apr 26, 2024

React recently released 18.3.0, Thye CI needs to be adjusted, please wait #48640.

@Enigama Enigama force-pushed the feature-drawer-loading branch 2 times, most recently from 4f93c22 to a7214d6 Compare April 26, 2024 09:20
@Enigama
Copy link
Contributor Author

Enigama commented Apr 26, 2024

#48661

@Enigama
Copy link
Contributor Author

Enigama commented Apr 26, 2024

@yoyo837 Can we merge it?

@Enigama
Copy link
Contributor Author

Enigama commented Apr 26, 2024

@yoyo837 I see that e2e has failed, I locally ran the command to update snap test:site-update it's again in scripts folder, should i commit it? Or it's fine?
image

@Enigama
Copy link
Contributor Author

Enigama commented Apr 26, 2024

@yoyo837 @afc163 @zombieJ @MadCcc All check are passed, can it be merged?

@afc163 afc163 merged commit 6f6868f into ant-design:feature Apr 29, 2024
60 checks passed
Copy link
Contributor

🎉 Thank you for your contribution! If you have not yet joined our DingTalk community group, please feel free to join us (when joining, please provide the link to this PR).

🎉 感谢您的贡献!如果您还没有加入钉钉社区群,请扫描下方二维码加入我们(加群时请提供此 PR 链接)。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants