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

Merged
merged 19 commits into from
Dec 31, 2024
Merged

Conversation

weird94
Copy link
Contributor

@weird94 weird94 commented Dec 18, 2024

BREAKING CHANGE: most async facade api was changed to sync api.
Before:

await univerAPI.getActiveWorkbook().getActiveSheet().getRange('A1:A5').setValue('123');
await univerAPI.getActiveWorkbook().getActiveSheet().getRange('A1:A5').merge()

After:

univerAPI.getActiveWorkbook().getActiveSheet().getRange('A1:A5').setValue('123').merge();

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, 45 seconds
commit  0d7c849
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 31.79191% with 236 lines in your changes missing coverage. Please review.

Project coverage is 33.33%. Comparing base (a90779e) to head (0d7c849).
Report is 2 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% 30 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.33%   33.33%           
=======================================
  Files        2528     2528           
  Lines      130552   130620   +68     
  Branches    29147    29149    +2     
=======================================
+ Hits        43516    43540   +24     
- Misses      87036    87080   +44     

☔ 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

@weird94 weird94 merged commit c5fcf3e into dev Dec 31, 2024
9 checks passed
@weird94 weird94 deleted the feat/sync-facade branch December 31, 2024 08:44
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