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(core): new template doc property #9538

Open
wants to merge 6 commits into
base: canary
Choose a base branch
from

Conversation

CatsJuice
Copy link
Member

@CatsJuice CatsJuice commented Jan 6, 2025

@github-actions github-actions bot added mod:i18n Related to i18n app:core labels Jan 6, 2025
Copy link
Member Author

CatsJuice commented Jan 6, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@CatsJuice CatsJuice changed the title temp feat(core): new template doc property Jan 6, 2025
@CatsJuice CatsJuice force-pushed the catsjuice/feat/template-doc branch from 5935bbf to 70fdcf3 Compare January 6, 2025 05:11
@CatsJuice CatsJuice marked this pull request as ready for review January 6, 2025 05:16
Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 2.63158% with 37 lines in your changes missing coverage. Please review.

Project coverage is 52.63%. Comparing base (a4841bb) to head (4aa21f2).
Report is 3 commits behind head on canary.

Files with missing lines Patch % Lines
...ges/frontend/core/src/modules/doc/services/docs.ts 0.00% 31 Missing ⚠️
...ages/frontend/core/src/modules/doc/entities/doc.ts 0.00% 3 Missing ⚠️
...s/frontend/core/src/modules/doc/entities/record.ts 0.00% 2 Missing ⚠️
...kages/frontend/core/src/modules/doc/stores/docs.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           canary    #9538      +/-   ##
==========================================
- Coverage   52.93%   52.63%   -0.30%     
==========================================
  Files        2170     2174       +4     
  Lines       97494    97614     +120     
  Branches    16646    16625      -21     
==========================================
- Hits        51609    51384     -225     
- Misses      44471    44790     +319     
- Partials     1414     1440      +26     
Flag Coverage Δ
server-test 78.04% <ø> (-0.64%) ⬇️
unittest 32.27% <2.63%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@CatsJuice CatsJuice force-pushed the catsjuice/feat/template-doc branch from a136e6d to f8bfa51 Compare January 8, 2025 02:48
const disposable = doc.slots.blockUpdated.on(() => {
const empty = doc.isEmpty;
setIsEmpty(empty);
// once the doc is not empty, stop checking
Copy link
Member

Choose a reason for hiding this comment

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

what if user delete all the content?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is acceptable to display the Starter only when it is empty for the first time; otherwise, any edits need to check whether the document is empty.

tests/kit/utils/setting.ts Outdated Show resolved Hide resolved
}

public getTemplateDocs() {
return Object.values(this.docsService.allDocProperties$.value)
Copy link
Member

Choose a reason for hiding this comment

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

what about use this.listStore.getTemplateDocIds()

Copy link
Member

Choose a reason for hiding this comment

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

you can add a watch version this.listStore.watchTemplateDocIds()

Copy link
Member Author

Choose a reason for hiding this comment

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

Watch is unnecessary for now since the list will only show in popup.

};

export const StarterBar = ({ doc }: { doc: Blocks }) => {
const [isEmpty, setIsEmpty] = useState(doc.isEmpty);
Copy link
Member

Choose a reason for hiding this comment

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

It seems that this will never be empty, because doc has at least one note

Copy link
Member Author

Choose a reason for hiding this comment

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

The empty judgment logic has been refactored in #9570

@CatsJuice CatsJuice force-pushed the catsjuice/feat/template-doc branch from f8bfa51 to e484196 Compare January 8, 2025 06:41
@CatsJuice CatsJuice force-pushed the catsjuice/feat/template-doc branch from e484196 to 0905ead Compare January 8, 2025 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app:core mod:i18n Related to i18n test Related to test cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants