Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

feat(facade): add unit hooks#3158

Open
hexf00 wants to merge1 commit intodev
base:dev
Choose a base branch
Loading
fromfeat/facade-unit-hooks
Open

Conversation

hexf00
Copy link
Member

@hexf00hexf00 commentedAug 22, 2024
edited
Loading

Hooks naming will be standardized to the format: prefix + verb in present tense + noun.

  • beforeCreateUnit
  • afterCreateUnit
  • beforeDisposeUnit
  • afterDisposeUnit

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).

for (const callback of this.beforeUnitAddCallbacks) {
if (callback(unit) === false) {
// if not use throw error, the createUnit returns null
throw new Error('[UniverInstanceService]: cannot add unit with user callback.');
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

@wzhudev Check if this has been handled properly.

Copy link
Member

Choose a reason for hiding this comment

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

I don't know. It is your responsibility to check if it is handled properly.

@github-actionsGitHub Actions
Copy link

github-actionsbot commentedAug 22, 2024
edited
Loading

View Deployment

📑 Examples📚 Storybook
🔗 Preview link🔗 Preview link

});

// TODO: not calling dispose() method
// unit.dispose();
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

@wzhudev The unit.dispose() function is not associated; in the future, a better and more unified mechanism is needed. Consider movingdispose toUnitModel or an intermediate layer. Usedispose for the destroy function.

Copy link
Member

Choose a reason for hiding this comment

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

Already clearified this with hexf00 offline.

@hexf00hexf00force-pushed thefeat/facade-unit-hooks branch from8a0b16c to0e106b7CompareAugust 22, 2024 14:32
@hexf00hexf00 marked this pull request as ready for reviewAugust 22, 2024 14:34
@codecovCodecov
Copy link

codecovbot commentedAug 22, 2024
edited
Loading

Codecov Report

Attention: Patch coverage is72.22222% with15 lines in your changes missing coverage. Please review.

Project coverage is 27.65%. Comparing base(71857c1) to head(7423d7c).
Report is 1 commits behind head on dev.

FilesPatch %Lines
packages/facade/src/apis/hooks/f-unit-hooks.ts72.72%9 Missing⚠️
...ges/core/src/services/instance/instance.service.ts45.45%6 Missing⚠️
Additional details and impacted files
@@            Coverage Diff             @@##              dev    #3158      +/-   ##==========================================+ Coverage   27.63%   27.65%   +0.01%==========================================  Files        1984     1985       +1       Lines      105556   105605      +49       Branches    22792    22795       +3     ==========================================+ Hits        29172    29200      +28- Misses      76384    76405      +21

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

@hexf00hexf00force-pushed thefeat/facade-unit-hooks branch from0e106b7 to7423d7cCompareAugust 23, 2024 02:41
@@ -47,6 +47,11 @@ export interface ICreateUnitOptions {
* It also manages the focused univer instance.
*/
export interface IUniverInstanceService {
/** A set of callbacks that will be called before a new unit is added. */
Copy link
Member

Choose a reason for hiding this comment

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

Should never expose internal properties as mutable. Instead, provide methods to do that.

// TODO: not calling dispose() method
// unit.dispose();

const _univerInstanceService = get(IUniverInstanceService);
Copy link
Member

Choose a reason for hiding this comment

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

Not necessary to add an underscore before a variable. The underbar has a special usage for "not used variables".

});

// TODO: not calling dispose() method
// unit.dispose();
Copy link
Member

Choose a reason for hiding this comment

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

Already clearified this with hexf00 offline.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@wzhudevwzhudevwzhudev requested changes

@DushusirDushusirAwaiting requested review from Dushusir

@weird94weird94Awaiting requested review from weird94weird94 is a code owner

@VicKun4937VicKun4937Awaiting requested review from VicKun4937VicKun4937 is a code owner

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@hexf00@wzhudev

[8]ページ先頭

©2009-2025 Movatter.jp