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

Add aper-leptos #46

Merged
merged 3 commits into from
Oct 5, 2024
Merged

Add aper-leptos #46

merged 3 commits into from
Oct 5, 2024

Conversation

paulgb
Copy link
Member

@paulgb paulgb commented Oct 5, 2024

No description provided.

Copy link

coderabbitai bot commented Oct 5, 2024

Caution

Review failed

The pull request is closed.

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes introduced in this pull request primarily involve modifications to the Cargo.toml files for a Rust workspace, including the addition of a new package, aper-leptos. The workspace configuration now lists aper-leptos as a member while removing the aper and aper/aper-derive* entries. In the counter-client package, dependencies aper-websocket-client and aper-stateroom have been updated to version 0.5.0, and the new dependency aper-leptos has been added.

The aper-leptos package is defined with its own Cargo.toml, specifying version 0.5.0 and including dependencies such as aper, aper-websocket-client, leptos, serde, and tracing libraries. A new trait, Watch<T>, has been introduced in aper-leptos/src/lib.rs, providing functionality for observing changes in an Atom<T> type.

Additionally, the lib.rs file in the counter-leptos project has been updated to simplify state management by replacing a trigger mechanism with direct observation using the watch method. The Counter struct in the common module has also seen changes, specifically in the apply method, which now uses IntentMetadata instead of IntentEvent.

Possibly related PRs

  • Add aper-leptos #46: The changes in this PR directly relate to the modifications made in the Cargo.toml file for the Rust workspace, specifically the addition of aper-leptos and the updates to dependencies, which are also reflected in the main PR.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (9)
examples/counter-leptos/client/src/lib.rs (2)

28-30: LGTM! Consider minor formatting improvement.

The change to state.value.watch() simplifies the state management, making the code more concise and potentially more efficient. This aligns well with the new Watch trait imported from aper_leptos.

Consider simplifying the formatting for better readability:

-            {
-                state.value.watch()
-            }
+            { state.value.watch() }

Line range hint 39-39: Consider moving tracing initialization to a shared module.

While the init_tracing::init_tracing() call remains unchanged, it might be beneficial to move this to a shared module for better code organization and reusability across different parts of the application.

Consider creating a new shared module for initialization tasks and moving the tracing initialization there. This could improve the overall structure of the application.

aper/src/data_structures/atom.rs (3)

Line range hint 5-9: LGTM: Well-structured Atom definition with appropriate trait bounds.

The Atom struct is well-defined with correct use of generics and PhantomData. The trait bounds are suitable for the implemented methods.

Consider adding a brief documentation comment explaining the purpose and usage of the Atom struct.


Line range hint 11-21: LGTM: AperSync implementation is correct and concise.

The AperSync trait implementation for Atom<T> is well-structured. The attach method properly initializes the struct, and the listen method correctly delegates to the underlying map's listen method.

Consider adding error handling or documentation about potential errors in the attach method, especially if StoreHandle creation can fail.


Improve error handling in Atom<T> methods.

The current implementation of the get and set methods in Atom<T> uses expect and unwrap, which can lead to runtime panics if deserialization or serialization fails. It's recommended to implement proper error handling to make the code more robust.

Additionally, while the use of a single Bytes::new() key suggests that this Atom<T> is intended to store only one value, please verify if this single-key design aligns with the intended use cases across the project.

🔗 Analysis chain

Line range hint 23-36: Improve error handling and consider key usage in Atom implementation.

The implementation of get and set methods for Atom<T> is functional but has some areas for improvement:

  1. Error Handling: Both methods use expect or unwrap, which can cause panics.
  2. Key Usage: Both methods use an empty Bytes key, which limits the Atom to storing only one value.

Consider the following improvements:

  1. Implement proper error handling:

    pub fn get(&self) -> Result<T, Box<dyn std::error::Error>> {
        self.map
            .get(&Bytes::new())
            .map(|bytes| bincode::deserialize(&bytes))
            .transpose()?
            .ok_or_else(|| Box::new(std::io::Error::new(std::io::ErrorKind::NotFound, "Value not found")))
    }
    
    pub fn set(&mut self, value: T) -> Result<(), Box<dyn std::error::Error>> {
        let serialized = bincode::serialize(&value)?;
        self.map.set(Bytes::new(), Bytes::from(serialized));
        Ok(())
    }
  2. If multiple values storage is intended, consider parameterizing the key:

    pub fn get(&self, key: &[u8]) -> Result<T, Box<dyn std::error::Error>> {
        // ... use key instead of Bytes::new()
    }
    
    pub fn set(&mut self, key: &[u8], value: T) -> Result<(), Box<dyn std::error::Error>> {
        // ... use key instead of Bytes::new()
    }

To ensure that the current implementation of using a single empty key is intentional, please run the following script:

This will help verify if the current single-value design is sufficient for all use cases in the project.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for multiple usages of Atom that might require different keys

# Test: Search for Atom usage in the codebase
rg --type rust "Atom<.*>"

# Test: Search for get() and set() method calls on Atom instances
rg --type rust "\.get\(\s*\)" -C 2
rg --type rust "\.set\(\s*.*\)" -C 2

Length of output: 25911

aper-leptos/src/lib.rs (2)

13-13: Remove unnecessary trait bounds on T.

The trait bound Default may not be necessary here unless specifically required elsewhere. Also, consider if all the trait bounds are needed for T in this context, and remove any that are unnecessary to simplify usage.

Consider applying this diff:

 where
-    T: Serialize + DeserializeOwned + Default + Clone + Send + Sync + 'static,
+    T: Serialize + DeserializeOwned + Clone + Send + Sync + 'static,

2-2: Import ReadSignal for completeness.

Since you're now returning ReadSignal<T>, ensure that it's imported from leptos.

Apply this diff:

 use leptos::{create_signal, SignalGet, SignalSet};
+use leptos::ReadSignal;
aper/src/store/iter.rs (2)

Line range hint 28-38: Update Lifetimes in PeekedIterator Definition

With the change to store owned values in next_value, the lifetime parameter 'a in PeekedIterator<'a> may no longer be necessary or might need adjustment. The owned Bytes and PrefixMapValue do not require lifetime annotations.

Recommendation:

  • Remove or Adjust Lifetime Parameters:

    -struct PeekedIterator<'a> {
    -    next_value: (&'a Bytes, &'a PrefixMapValue),
    +struct PeekedIterator {
    +    next_value: (Bytes, PrefixMapValue),
         layer_rank: usize,
    -    rest: BTreeMapIter<'a, Bytes, PrefixMapValue>,
    +    rest: BTreeMapIter<'a, Bytes, PrefixMapValue>, // Adjust if necessary
    }
  • Review Lifetime Annotations: Ensure that other lifetime annotations in the struct and its implementations are updated accordingly.


Line range hint 95-148: Unit Tests May Need Updates

The unit tests use references when creating iterators. With the change to owned next_value, verify that the tests still compile and behave as expected.

Recommendation:

  • Update Test Iterators: Ensure that the iterators in tests are compatible with the updated PeekedIterator.

  • Run All Tests: Execute all unit tests to confirm they pass with the new changes.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 24c7e51 and e2118c3.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • examples/counter-leptos/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • Cargo.toml (1 hunks)
  • aper-leptos/Cargo.toml (1 hunks)
  • aper-leptos/src/lib.rs (1 hunks)
  • aper/src/data_structures/atom.rs (1 hunks)
  • aper/src/store/core.rs (1 hunks)
  • aper/src/store/iter.rs (1 hunks)
  • examples/counter-leptos/client/Cargo.toml (1 hunks)
  • examples/counter-leptos/client/src/lib.rs (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • aper-leptos/Cargo.toml
🔇 Additional comments (11)
Cargo.toml (1)

15-15: LGTM: Addition of aper-leptos to workspace members

The addition of "aper-leptos" to the workspace members is consistent with the PR objective of "Add aper-leptos". This change expands the project structure to include a new module, which is likely to introduce new functionality related to the Leptos framework in the context of the Aper project.

A few points to consider:

  1. The formatting is consistent with the existing entries, maintaining readability.
  2. Ensure that the "aper-leptos" directory exists in the project structure.
  3. Be aware that this addition may affect the build process and dependencies for the entire workspace.

To verify the existence of the "aper-leptos" directory and its basic structure, you can run the following script:

This script will help ensure that the necessary directory and essential files for a Rust crate are present.

✅ Verification successful

Verified: aper-leptos directory and essential files are present

The aper-leptos directory exists and contains both Cargo.toml and src/lib.rs. This confirms that the addition to the workspace members has been correctly implemented and the new module is properly set up.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and basic structure of the aper-leptos directory

# Check if the aper-leptos directory exists
if [ -d "aper-leptos" ]; then
    echo "aper-leptos directory exists"
    
    # Check for essential files
    for file in Cargo.toml src/lib.rs; do
        if [ -f "aper-leptos/$file" ]; then
            echo "Found $file"
        else
            echo "Missing $file"
        fi
    done
else
    echo "aper-leptos directory does not exist"
fi

Length of output: 321

examples/counter-leptos/client/Cargo.toml (4)

12-12: LGTM: Addition of aper-leptos dependency

The addition of the aper-leptos dependency with version "0.5.0" aligns with the PR objective. The use of a local path suggests this is part of the same workspace or monorepo, which is a good practice for maintaining consistency across related packages.


13-13: LGTM: Version update for aper-websocket-client

The version update of aper-websocket-client to "0.5.0" is consistent with the other aper-related dependencies. This update helps maintain version compatibility across the project.


14-14: LGTM: Version update for aper-stateroom

The version update of aper-stateroom to "0.5.0" is in line with the other aper-related dependencies. This update ensures version consistency across the project.


12-14: Summary: Consistent dependency updates and addition

The changes in this file are well-structured and consistent:

  1. Added aper-leptos dependency (v0.5.0)
  2. Updated aper-websocket-client to v0.5.0
  3. Updated aper-stateroom to v0.5.0

These updates align with the PR objective of adding aper-leptos and ensure version consistency across aper-related dependencies. The use of local paths for these dependencies suggests a well-organized workspace or monorepo structure.

examples/counter-leptos/client/src/lib.rs (2)

Line range hint 1-42: Overall, the changes look good and align with the PR objective.

The modifications successfully integrate aper-leptos, improving the state management approach and simplifying the code. The new Watch mechanism provides a more direct way to handle state updates.

Key improvements:

  1. Simplified import structure with aper_leptos.
  2. More efficient state watching with state.value.watch().

Consider the suggested minor improvements for even better code quality and organization.


1-1: LGTM! Verify aper-leptos dependency.

The change from aper::AperSync to aper_leptos::{init_tracing, Watch} aligns with the PR objective of adding aper-leptos. This suggests a more tailored integration with Leptos, potentially offering improved state management.

Please ensure that the aper-leptos dependency is correctly added to the Cargo.toml file. Run the following script to verify:

aper/src/data_structures/atom.rs (1)

Line range hint 1-3: LGTM: Imports are appropriate and concise.

The imports are well-chosen for the implemented functionality, including necessary traits and types from the crate, bytes, and serde.

aper/src/store/core.rs (1)

Line range hint 101-114: Approved: Improved concurrency with read lock

The change from write() to read() when accessing layers is a good improvement. It allows for better concurrency by permitting multiple threads to read the layers simultaneously, which is appropriate for this method that only reads data without modifying it.

To ensure this change doesn't introduce any thread safety issues or potential deadlocks, please run the following verification:

This script will help identify any potential issues related to thread safety or deadlocks that might have been introduced by this change. Please review the results and make any necessary adjustments to ensure thread safety across the entire Store implementation.

✅ Verification successful

Verified: No thread safety issues or deadlocks introduced

The analysis confirms that while other methods still use write locks on layers, there are no detected deadlock scenarios or public methods modifying layers without a write lock. The change to a read lock in the top_layer_mutations method appropriately enhances concurrency without compromising thread safety.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify thread safety and potential deadlocks

# Test 1: Check for any write locks on `layers` in other methods
echo "Checking for write locks on layers:"
rg --type rust 'layers.*write\(\)' aper/src/store/

# Test 2: Look for potential deadlock scenarios
echo "Checking for potential deadlock scenarios:"
rg --type rust 'layers.*(?:read|write)\(\).*listeners.*lock\(\)' aper/src/store/
rg --type rust 'listeners.*lock\(\).*layers.*(?:read|write)\(\)' aper/src/store/

# Test 3: Verify that no public methods modify layers without a write lock
echo "Checking for public methods that might modify layers without a write lock:"
ast-grep --lang rust --pattern $'impl Store {
  $$$
  pub fn $_($$) {
    $$$
    $layers
    $$$
  }
  $$$
}'

Length of output: 1443

aper/src/store/iter.rs (2)

Line range hint 12-25: Adjust Ord and PartialOrd Implementations After Ownership Change

With next_value now owning the data, the cmp method in the Ord implementation may behave differently, especially if Bytes and PrefixMapValue do not implement Ord or if their comparison semantics differ when owned.

Recommendation:

  • Verify Comparison Logic: Ensure that the comparison between Bytes works as intended. The Bytes type compares the byte sequences; confirm this meets the requirements.

  • Implement or Derive Ord and Eq for Bytes and PrefixMapValue if necessary.


Line range hint 70-92: Ensure Consistency in Iteration Logic

The changes to next_value could affect how the iterator processes elements. Verify that the iterator correctly handles the owned values, especially when cloning or moving them into the result vector.

Recommendation:

  • Test with Various Data Sets: Use the provided unit tests and add more cases to cover scenarios with large data and different key/value combinations.

  • Check for Unintended Clones: Profile the code to identify any performance regressions due to cloning.

Comment on lines 15 to 25
fn watch(&self) -> Box<dyn Fn() -> T> {
let (signal, set_signal) = create_signal(self.get());

let self_clone = self.clone();
self.listen(move || {
set_signal.set(self_clone.get());
true
});

Box::new(move || signal.get())
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Update the implementation to return ReadSignal<T> directly.

By returning the ReadSignal<T> from create_signal, you simplify the code and provide a more flexible interface for the consumers of the watch method.

Apply this diff to update the implementation:

 fn watch(&self) -> ReadSignal<T> {
     let (signal, set_signal) = create_signal(self.get());

     let self_clone = self.clone();
     self.listen(move || {
         set_signal.set(self_clone.get());
         true
     });

-    Box::new(move || signal.get())
+    signal
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fn watch(&self) -> Box<dyn Fn() -> T> {
let (signal, set_signal) = create_signal(self.get());
let self_clone = self.clone();
self.listen(move || {
set_signal.set(self_clone.get());
true
});
Box::new(move || signal.get())
}
fn watch(&self) -> ReadSignal<T> {
let (signal, set_signal) = create_signal(self.get());
let self_clone = self.clone();
self.listen(move || {
set_signal.set(self_clone.get());
true
});
signal
}

Comment on lines 7 to 9
pub trait Watch<T> {
fn watch(&self) -> Box<dyn Fn() -> T>;
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider returning ReadSignal<T> instead of Box<dyn Fn() -> T>.

Returning a ReadSignal<T> directly is more idiomatic in Leptos and allows consumers to leverage the full capabilities of signals, including reactive updates and integration with the Leptos ecosystem. This also removes the need to box a closure, improving performance and type safety.

Apply this diff to change the return type in the trait definition:

+use leptos::ReadSignal;

 pub trait Watch<T> {
-    fn watch(&self) -> Box<dyn Fn() -> T>;
+    fn watch(&self) -> ReadSignal<T>;
 }

Committable suggestion was skipped due to low confidence.

@@ -47,7 +47,7 @@ impl StoreIterator {
if let Some((key, value)) = next_value {
println!("pushing... {:?}", key);
heap.push(PeekedIterator {
next_value: (&key, value),
next_value: (key, value),
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Potential Performance Impact Due to Cloning

At line 50, the next_value is now storing owned Bytes and PrefixMapValue:

next_value: (key, value),

This change shifts from borrowing references to owning the values, which could result in additional cloning of data. Since Bytes is a reference-counted byte buffer (Bytes from the bytes crate), cloning it is cheap as it involves incrementing the reference count. However, for PrefixMapValue, if it contains large data and does not implement cheap cloning, this could introduce performance overhead.

Recommendation:

  • Assess the necessity of ownership: If ownership is not required, consider retaining references to avoid unnecessary data cloning.

  • Use Cow (Clone-on-Write): If the data might be modified later, Cow can provide flexibility between borrowing and owning.

  • Ensure Cloning is Efficient: If ownership is necessary, ensure that the Clone implementations for Bytes and PrefixMapValue are efficient.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
examples/counter-leptos/client/src/lib.rs (1)

22-24: LGTM! Simplified state management implementation.

The direct use of state.value.watch() streamlines the state update mechanism, eliminating the need for a separate trigger. This change improves code clarity and maintainability.

Consider simplifying the formatting for better readability:

-            {
-                state.value.watch()
-            }
+            { state.value.watch() }
examples/counter-leptos/common/src/lib.rs (2)

26-29: LGTM: Method signature updated to use intent and metadata.

The apply method has been successfully updated to use the new intent-based approach. The changes are consistent and maintain the existing functionality.

However, consider adding a comment explaining the purpose of the _metadata parameter, even if it's currently unused. This will help future developers understand its intended use.

Consider adding a comment like this:

/// Apply the given intent to the Counter.
/// 
/// # Arguments
/// 
/// * `intent` - The CounterIntent to apply
/// * `_metadata` - Additional metadata about the intent (currently unused)
fn apply(&mut self, intent: &CounterIntent, _metadata: &IntentMetadata) -> Result<(), ()> {
    // ... existing implementation ...
}

Intent-Based Approach Inconsistently Applied Across Codebase

The verification results show that while the Counter struct in examples/counter-leptos/common/src/lib.rs uses the new intent-based approach with IntentMetadata, there are still multiple instances of IntentEvent being used in other parts of the codebase. This indicates that the intent-based system has not been uniformly implemented across all relevant components.

  • examples/timer/common/src/lib.rs
  • examples/drop-four/common/src/state.rs
  • aper/tests/tic-tac-toe.rs
  • aper/tests/simple-client-server.rs
  • aper/tests/listener.rs
  • examples/counter/common/src/lib.rs
🔗 Analysis chain

Line range hint 1-42: Verify consistency of intent-based approach across the codebase.

The changes in this file suggest a shift towards an intent-based approach with metadata. To ensure consistency, it would be beneficial to verify if similar changes have been applied across the codebase where the Aper trait is implemented.

Run the following script to check for consistency:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistent implementation of Aper trait across the codebase

# Test 1: Search for Aper trait implementations
echo "Aper trait implementations:"
rg --type rust "impl\s+Aper\s+for" -g '!target/'

# Test 2: Check apply method signatures in Aper implementations
echo "\nApply method signatures in Aper implementations:"
rg --type rust "fn\s+apply.*IntentMetadata" -g '!target/'

# Test 3: Check for any remaining uses of IntentEvent
echo "\nRemaining uses of IntentEvent:"
rg --type rust "IntentEvent" -g '!target/'

Length of output: 3009

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between e2118c3 and 1da27b2.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • examples/counter-leptos/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • Cargo.toml (1 hunks)
  • aper-leptos/Cargo.toml (1 hunks)
  • aper-leptos/src/lib.rs (1 hunks)
  • examples/counter-leptos/client/Cargo.toml (1 hunks)
  • examples/counter-leptos/client/src/lib.rs (2 hunks)
  • examples/counter-leptos/common/src/lib.rs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • Cargo.toml
  • aper-leptos/Cargo.toml
  • aper-leptos/src/lib.rs
  • examples/counter-leptos/client/Cargo.toml
🔇 Additional comments (3)
examples/counter-leptos/client/src/lib.rs (2)

Line range hint 31-31: Verify the location of the init_tracing module.

The AI summary suggests that the init_tracing module should be moved to a shared location, but it's still present in this file. Consider moving it to a shared module if it's used across multiple components.

Let's check if init_tracing is defined in this file or imported from elsewhere:

#!/bin/bash
# Description: Verify the location of init_tracing module
# Test 1: Check if init_tracing is defined in this file
rg --type rust 'mod init_tracing' examples/counter-leptos/client/src/lib.rs

# Test 2: Check if init_tracing is imported from another module
rg --type rust 'use .+::init_tracing' examples/counter-leptos/client/src/lib.rs

If init_tracing is imported from another module, consider updating the comment to reflect its current location.


2-2: LGTM! Import changes align with new state management strategy.

The new import use aper_leptos::{init_tracing, Watch}; introduces the necessary components for the updated state management approach.

Let's verify the removal of the old import:

examples/counter-leptos/common/src/lib.rs (1)

1-1: LGTM: Import statement updated to reflect new intent-based approach.

The change from IntentEvent to IntentMetadata in the import statement is consistent with the modifications in the apply method. This shift suggests a move towards a more direct intent-based approach with additional metadata support.

@paulgb paulgb merged commit 6475771 into main Oct 5, 2024
1 check passed
@paulgb paulgb deleted the paulgb/add-aper-leptos branch October 5, 2024 15:55
@coderabbitai coderabbitai bot mentioned this pull request Oct 5, 2024
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.

1 participant