Skip to content

to reduce load time &white space#8286

Closed
ShekFarman wants to merge 2 commits intoAppFlowy-IO:mainfrom
ShekFarman:main
Closed

to reduce load time &white space#8286
ShekFarman wants to merge 2 commits intoAppFlowy-IO:mainfrom
ShekFarman:main

Conversation

@ShekFarman
Copy link

@ShekFarman ShekFarman commented Oct 10, 2025

Feature Preview


PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

Summary by Sourcery

Gate Dart protobuf code generation behind the "dart" feature flag and add logging to indicate when generation runs or is skipped

Enhancements:

  • Wrap Dart codegen calls in cfg(feature="dart") blocks to avoid unconditional generation
  • Add println messages for both enabled and disabled Dart feature cases in the build script

the updated code to reduce loading time & white spaces
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 10, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR refactors the build script to gate Dart protobuf code generation behind a Cargo feature flag and adds logging to inform users whether code generation runs or is skipped.

File-Level Changes

Change Details Files
Gate Dart code generation behind the "dart" feature flag
  • Wrapped the protobuf code generation call in a #[cfg(feature = "dart")] block
  • Added a #[cfg(not(feature = "dart"))] block to skip code generation when the feature is disabled
frontend/rust-lib/dart-ffi/build.rs
Introduce console logging for generation status
  • Print a message when Dart protobuf code is being generated
  • Print a message when Dart feature is not enabled to indicate skipping
frontend/rust-lib/dart-ffi/build.rs

Possibly linked issues

  • #unknown: The PR modifies Dart protobuf generation with conditional logic, directly addressing the issue of protobufs not being generated.
  • #the issue: The PR fixes the issue by ensuring Dart protobuf files are generated when the 'dart' feature is enabled, resolving missing file and type errors.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `frontend/rust-lib/dart-ffi/build.rs:2-3` </location>
<code_context>
 fn main() {
+  #[cfg(feature = "dart")]
   flowy_codegen::protobuf_file::dart_gen(env!("CARGO_PKG_NAME"));
+    #[cfg(feature = "dart")]
+    {
</code_context>

<issue_to_address>
**issue:** Redundant code: duplicate Dart code generation under feature flag.

Remove the first call to `dart_gen` under the `dart` feature flag to eliminate duplication.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +2 to 3
#[cfg(feature = "dart")]
flowy_codegen::protobuf_file::dart_gen(env!("CARGO_PKG_NAME"));
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: Redundant code: duplicate Dart code generation under feature flag.

Remove the first call to dart_gen under the dart feature flag to eliminate duplication.

@LucasXu0 LucasXu0 closed this Nov 6, 2025
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