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(facade): make facade api sync and chainable #4329

Open
wants to merge 17 commits into
base: dev
Choose a base branch
from

Conversation

weird94
Copy link
Contributor

@weird94 weird94 commented Dec 18, 2024

Facade API编写原则

  1. 同步API优先,并支持链式调用。
  2. 对于异步API,做以下考虑:
    1. 能否拆分出一个同步子API,将如二次确定等逻辑剥离(facade-api也不应该包含二次确认等业务逻辑,业务逻辑应该由开发者自行决定)。
    2. 对于必须是异步的API,需要在方法名上标注,如 addCommentAsync。
  3. 命令编写原则同上,同步优先,异步命令需要拆分。

Pull Request Checklist

  • Related tickets or issues have been linked in the PR description (or missing issue).
  • Naming convention is followed (do please check it especially when you created new plugins, commands and resources).
  • Unit tests have been added for the changes (if applicable).
  • Breaking changes have been documented (or no breaking changes introduced in this PR).

Copy link

github-actions bot commented Dec 18, 2024

View Deployment

📑 Examples 📚 Storybook
🔗 Preview link 🔗 Preview link

Copy link

github-actions bot commented Dec 18, 2024

Playwright test results

passed  21 passed

Details

stats  21 tests across 10 suites
duration  4 minutes, 46 seconds
commit  8a5a9b0
info  For more information, see full report

@weird94 weird94 requested a review from jikkai as a code owner December 18, 2024 11:26
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 32.06997% with 233 lines in your changes missing coverage. Please review.

Project coverage is 33.38%. Comparing base (bab2f09) to head (8a5a9b0).
Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
packages/sheets/src/facade/f-worksheet.ts 0.00% 96 Missing ⚠️
packages/sheets/src/facade/f-range.ts 0.00% 27 Missing ⚠️
packages/sheets/src/facade/f-workbook.ts 0.00% 17 Missing ⚠️
...heets-conditional-formatting/src/facade/f-range.ts 0.00% 12 Missing ⚠️
...s-conditional-formatting/src/facade/f-worksheet.ts 0.00% 12 Missing ⚠️
packages/sheets-filter/src/facade/f-filter.ts 0.00% 11 Missing ⚠️
...ts-data-validation/src/facade/f-data-validation.ts 0.00% 10 Missing ⚠️
.../sheets-crosshair-highlight/src/facade/f-univer.ts 0.00% 7 Missing ⚠️
...ts/src/commands/commands/remove-row-col.command.ts 92.00% 4 Missing ⚠️
.../sheets/src/commands/commands/set-style.command.ts 87.09% 4 Missing ⚠️
... and 15 more
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #4329      +/-   ##
==========================================
+ Coverage   33.36%   33.38%   +0.01%     
==========================================
  Files        2515     2515              
  Lines      129819   129886      +67     
  Branches    29005    29007       +2     
==========================================
+ Hits        43317    43362      +45     
- Misses      86502    86524      +22     

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

@univer-bot
Copy link

univer-bot bot commented Dec 20, 2024

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

Origin Title: feat(facade): make facade api sync and chainable

Title: feat(facade): make facade api sync and chainable


Facade API writing principles

  1. Synchronous API takes priority and supports chain calls.
  2. For asynchronous APIs, make the following considerations:
    1. Can a synchronization sub-API be split to strip away logic such as secondary confirmation (facade-api should not include business logic such as secondary confirmation, and the business logic should be decided by the developer).
    2. For APIs that must be asynchronous, the method name needs to be marked, such as addCommentAsync.
  3. The command writing principles are the same as above, synchronization is given priority, and asynchronous commands need to be split.

Pull Request Checklist

  • Related tickets or issues have been linked in the PR description (or missing issue).
  • Naming convention is followed (do please check it especially when you created new plugins, commands and resources).
  • Unit tests have been added for the changes (if applicable).
  • Breaking changes have been documented (or no breaking changes introduced in this PR).

Copy link
Member

@Dushusir Dushusir left a comment

Choose a reason for hiding this comment

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

I recommend QA to do regression testing

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.

3 participants