8000 feat: unEffect and unEffectScope by Shinigami92 · Pull Request #43 · un-ts/unuse · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: unEffect and unEffectScope #43

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

Merged
merged 1 commit into from
Jun 26, 2025
Merged

feat: unEffect and unEffectScope #43

merged 1 commit into from
Jun 26, 2025

Conversation

Shinigami92
Copy link
Member
@Shinigami92 Shinigami92 commented Jun 26, 2025

We now completely wrap alien-signals behind the scenes and expose our own un-signal/reactivity system.

Right now unEffect and unEffectScope are just wrappers around alien-signals effect and effectScope, but we can enhance it later with own functionality internally and control tracking of signal dependencies.


Important

Introduces unEffect and unEffectScope, replacing alien-signals with internal implementations across Angular, React, Solid, and Vue integrations.

  • New Features:
    • Introduced unEffect and unEffectScope in unEffect/index.ts and unEffectScope/index.ts.
    • Expanded public API to include unEffect and unEffectScope in index.ts.
  • Refactor:
    • Updated unuse-angular, unuse-react, unuse-solid, and unuse-vue to use unEffect for reactive synchronization in their respective index.ts files.
    • Replaced alien-signals with internal unEffect and unEffectScope in toUnSignal/index.ts, unResolve/index.ts, and unWatch/index.ts.
  • Chores:
    • Removed alien-signals dependency from package.json in unuse-angular, unuse-react, unuse-solid, and unuse-vue.
    • Added a changeset ten-melons-clap.md describing the new features and updates.

This description was created by Ellipsis for 4aa9125. You can customize this summary. It will automatically update as commits are pushed.


Summary by CodeRabbit

  • New Features

    • Introduced two new reactive utilities: unEffect and unEffectScope.
    • Expanded the public API to include these new utilities.
  • Refactor

    • Updated Angular, React, Solid, and Vue integrations to use unEffect for reactive synchronization.
    • Replaced usage of external reactive effect functions with internal equivalents across the codebase.
  • Chores

    • Added a changeset describing the new features and updates.

@Shinigami92 Shinigami92 self-assigned this Jun 26, 2025
@Shinigami92 Shinigami92 added the feature New feature label Jun 26, 2025
Copy link
changeset-bot bot commented Jun 26, 2025

🦋 Changeset detected

Latest commit: 4aa9125

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
unuse-angular Minor
unuse-react Minor
unuse-solid Minor
unuse-vue Minor
unuse Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
coderabbitai bot commented Jun 26, 2025

Walkthrough

This change introduces two new features, unEffect and unEffectScope, to the codebase and updates all framework adapter modules (Angular, React, Solid, Vue) and core utilities to use these new primitives instead of the previously imported effect and effectScope from alien-signals. The new features are exported from the main package, and all internal reactive effect logic now uses these wrappers for consistency.

Changes

Files/Paths Change Summary
.changeset/ten-melons-clap.md Added a changeset documenting the addition of unEffect and unEffectScope features.
packages/unuse-angular/src/index.ts Replaced effect with unEffect for Angular adapter reactivity.
packages/unuse-react/src/index.ts Replaced effect with unEffect for React adapter reactivity.
packages/unuse-solid/src/index.ts Replaced effect with unEffect for Solid adapter reactivity.
packages/unuse-vue/src/index.ts Replaced effect with unEffect for Vue adapter reactivity.
packages/unuse/src/index.ts Added exports for unEffect and unEffectScope.
packages/unuse/src/toUnSignal/index.ts Swapped all effect calls for unEffect in core signal conversion logic.
packages/unuse/src/unEffect/index.ts New module: defines and exports unEffect as a wrapper around effect.
packages/unuse/src/unEffectScope/index.ts New module: defines and exports unEffectScope as a wrapper around effectScope.
packages/unuse/src/unResolve/index.ts Updated to use unEffect instead of effect for all framework-specific reactivity.
packages/unuse/src/unWatch/index.ts Switched from effect/effectScope to unEffect/unEffectScope in the unWatch utility.
packages/unuse-angular/package.json Removed dependency on alien-signals.
packages/unuse-react/package.json Removed dependency on alien-signals.
packages/unuse-solid/package.json Removed dependency on alien-signals.
packages/unuse-vue/package.json Removed dependency on alien-signals.

Sequence Diagram(s)

sequenceDiagram
    participant FrameworkAdapter as Framework Adapter (Angular/React/Solid/Vue)
    participant unEffect as unEffect
    participant effect as effect (alien-signals)

    FrameworkAdapter->>unEffect: unEffect(callback)
    unEffect->>effect: effect(callback)
    effect-->>unEffect: disposer
    unEffect-->>FrameworkAdapter: disposer
Loading
sequenceDiagram
    participant User
    participant unEffectScope as unEffectScope
    participant effectScope as effectScope (alien-signals)

    User->>unEffectScope: unEffectScope(callback)
    unEffectScope->>effectScope: effectScope(callback)
    effectScope-->>unEffectScope: disposer
    unEffectScope-->>User: disposer
Loading

Poem

In the warren of code, a new path is shown,
With unEffect and scope, our signals have grown.
Frameworks now hop to a unified beat,
React, Vue, Angular—syncing so neat!
The rabbit applauds with a satisfied cheer,
For reactivity’s future is hopping right here.
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da0226e and 4aa9125.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (15)
  • .changeset/ten-melons-clap.md (1 hunks)
  • packages/unuse-angular/package.json (0 hunks)
  • packages/unuse-angular/src/index.ts (3 hunks)
  • packages/unuse-react/package.json (0 hunks)
  • packages/unuse-react/src/index.ts (3 hunks)
  • packages/unuse-solid/package.json (0 hunks)
  • packages/unuse-solid/src/index.ts (3 hunks)
  • packages/unuse-vue/package.json (0 hunks)
  • packages/unuse-vue/src/index.ts (3 hunks)
  • packages/unuse/src/index.ts (1 hunks)
  • packages/unuse/src/toUnSignal/index.ts (5 hunks)
  • packages/unuse/src/unEffect/index.ts (1 hunks)
  • packages/unuse/src/unEffectScope/index.ts (1 hunks)
  • packages/unuse/src/unResolve/index.ts (5 hunks)
  • packages/unuse/src/unWatch/index.ts (2 hunks)
💤 Files with no reviewable changes (4)
  • packages/unuse-vue/package.json
  • packages/unuse-solid/package.json
  • packages/unuse-react/package.json
  • packages/unuse-angular/package.json
🚧 Files skipped from review as they are similar to previous changes (9)
  • packages/unuse/src/unResolve/index.ts
  • packages/unuse-vue/src/index.ts
  • packages/unuse/src/toUnSignal/index.ts
  • packages/unuse-angular/src/index.ts
  • packages/unuse/src/unWatch/index.ts
  • .changeset/ten-melons-clap.md
  • packages/unuse/src/index.ts
  • packages/unuse-solid/src/index.ts
  • packages/unuse-react/src/index.ts
🧰 Additional context used
🪛 ESLint
packages/unuse/src/unEffect/index.ts

[error] 1-1: Unable to resolve path to module 'alien-signals'.

(import-x/no-unresolved)

packages/unuse/src/unEffectScope/index.ts

[error] 1-1: Unable to resolve path to module 'alien-signals'.

(import-x/no-unresolved)

🔇 Additional comments (5)
packages/unuse/src/unEffect/index.ts (3)

5-7: Implementation looks good for the wrapper pattern.

The function correctly delegates to the alien-signals effect function while maintaining the same signature. This establishes a clean abstraction layer as intended.


3-3: Verify the return type matches the actual alien-signals effect function.

The UnEffectReturn type is defined as () => void, but we should confirm this matches what the alien-signals effect function actually returns.

#!/bin/bash
# Description: Check alien-signals documentation or type definitions
# Expected: Confirm the return type of the effect function

# Look for TypeScript declaration files or documentation
fd -e "d.ts" -name "*alien*" --exec cat {} \;

1-1: To correctly detect whether alien-signals is declared in any of your package.json files, let’s search for its occurrence using ripgrep:

#!/bin/bash
# Search for "alien-signals" in all package.json files to see if it's declared
rg -n -g "package.json" '"alien-signals"'
packages/unuse/src/unEffectScope/index.ts (2)

5-7: Consistent implementation with unEffect - well done!

The implementation pattern perfectly mirrors the unEffect wrapper, maintaining consistency in the API design. This creates a cohesive abstraction layer over alien-signals.


3-3: Verify consistency of return type with effectScope function.

Similar to unEffect, confirm that UnEffectScopeReturn as () => void matches the actual return type of alien-signals' effectScope function.

#!/bin/bash
# Description: Verify the effectScope return type matches the type definition
# Expected: Both effect and effectScope should have consistent return types

# Search for effectScope usage patterns in the codebase to understand expected return type
rg -A 3 -B 1 "effectScope\(" --type ts
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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
Contributor
github-actions bot commented Jun 26, 2025

Coverage Report

Status Category Percentage Covered / Total
🔴 Lines 78.42% (🎯 90%)
⬇️ -0.04%
978 / 1247
🔴 Statements 78.42% (🎯 90%)
⬇️ -0.04%
978 / 1247
🔴 Functions 79.76% (🎯 90%)
⬆️ +0.50%
67 / 84
🔴 Branches 80.93% (🎯 85%)
⬆️ +0.12%
259 / 320
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/unuse-angular/src/index.ts 94.2%
⬇️ -0.08%
100%
🟰 ±0%
83.33%
🟰 ±0%
94.2%
⬇️ -0.08%
143-146
packages/unuse-react/src/index.ts 69.86%
⬇️ -0.41%
68.18%
🟰 ±0%
100%
🟰 ±0%
69.86%
⬇️ -0.41%
49-55, 58-71, 139-143, 152
packages/unuse-solid/src/index.ts 83.09%
⬇️ -0.24%
86.95%
🟰 ±0%
100%
🟰 ±0%
83.09%
⬇️ -0.24%
52-59, 69, 141-145
packages/unuse-vue/src/index.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
packages/unuse/src/index.ts 0%
🟰 ±0%
0%
🟰 ±0%
0%
🟰 ±0%
0%
🟰 ±0%
1-18
packages/unuse/src/toUnSignal/index.ts 73.04%
🟰 ±0%
63.33%
🟰 ±0%
66.66%
🟰 ±0%
73.04%
🟰 ±0%
18-19, 32-33, 36-37, 44-45, 49, 51-52, 74-75, 82-88, 99-100, 106-107, 114-121, 131, 141-142
packages/unuse/src/unEffect/index.ts 100% 100% 100% 100%
packages/unuse/src/unEffectScope/index.ts 100% 100% 100% 100%
packages/unuse/src/unResolve/index.ts 91.81%
🟰 ±0%
94.28%
🟰 ±0%
71.42%
🟰 ±0%
91.81%
🟰 ±0%
73-74, 95-96, 101, 127-130
packages/unuse/src/unWatch/index.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
Unchanged Files
packages/unuse/src/_framework/index.ts 81.53% 62.5% 100% 81.53% 48-49, 67-68, 76-77, 85-86, 94-95, 102-103
packages/unuse/src/_testUtils/angular.ts 100% 100% 100% 100%
packages/unuse/src/_testUtils/react.ts 100% 100% 100% 100%
packages/unuse/src/_testUtils/solid.ts 100% 100% 100% 100%
packages/unuse/src/_testUtils/vue.ts 100% 100% 100% 100%
packages/unuse/src/isClient/index.ts 100% 0% 100% 100%
packages/unuse/src/isObject/index.ts 100% 100% 100% 100%
packages/unuse/src/isWorker/index.ts 66.66% 0% 100% 66.66% 5
packages/unuse/src/toArray/index.ts 100% 50% 100% 100%
packages/unuse/src/tryOnScopeDispose/index.ts 77.77% 78.57% 50% 77.77% 11-14, 23-24, 35-36, 40-41
packages/unuse/src/unAccess/index.ts 63.36% 75% 66.66% 63.36% 45-46, 50-51, 64-65, 68-69, 73, 76-83, 86-95, 98-107, 116-117, 120-121, 124-125
packages/unuse/src/unComputed/index.ts 100% 100% 100% 100%
packages/unuse/src/unRefElement/index.ts 75% 33.33% 100% 75% 29, 36-37
packages/unuse/src/unSignal/index.ts 100% 100% 100% 100%
packages/unuse/src/useEventListener/index.ts 96.38% 86.66% 100% 96.38% 193-194, 199
packages/unuse/src/useIntervalFn/index.ts 92.98% 80% 100% 92.98% 78-79, 83-84
packages/unuse/src/useWebSocket/index.ts 46.93% 41.66% 33.33% 46.93% 162-164, 204-213, 217-219, 223-225, 234-236, 245-257, 263-264, 271-276, 279-309, 312-313, 316-327, 331-356, 368-369
Generated in workflow #106 for commit 4aa9125 by the Vitest Coverage Report Action

@Shinigami92 Shinigami92 requested a review from JounQin June 26, 2025 17:01
@Shinigami92 Shinigami92 marked this pull request as ready for review June 26, 2025 17:01
Copy link
Contributor
@ellipsis-dev ellipsis-dev bot left a comment 8000

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to da0226e in 1 minute and 41 seconds. Click for details.
  • Reviewed 331 lines of code in 11 files
  • Skipped 0 files when reviewing.
  • Skipped posting 19 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .changeset/ten-melons-clap.md:1
  • Draft comment:
    Changeset file correctly lists minor updates for all frameworks and the unuse package.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative and does not provide any actionable feedback or suggestions for improvement. It simply states that the changeset file lists minor updates, which does not help the PR author in any way.
2. packages/unuse-angular/src/index.ts:57
  • Draft comment:
    Replaced direct 'effect' call with 'unEffect' wrapper to encapsulate side effects and maintain consistent dependency tracking.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, explaining a change that was made without suggesting any improvements or asking for clarification. It doesn't provide actionable feedback or raise any concerns about the code.
3. packages/unuse-angular/src/index.ts:129
  • Draft comment:
    Using 'unEffect' instead of 'effect' for updating the Angular signal in unResolve; ensure the new abstraction behaves identically.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the author to ensure that the new abstraction behaves identically, which is against the rules. It doesn't provide a specific suggestion or point out a specific issue with the code.
4. packages/unuse-react/src/index.ts:64
  • Draft comment:
    Replaced the direct 'effect' call with 'unEffect' to handle React state updates consistently.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, explaining what was changed without providing any actionable feedback or suggestions. It doesn't ask for confirmation or suggest improvements.
5. packages/unuse-react/src/index.ts:142
  • Draft comment:
    Using 'unEffect' in the unResolve function for React to synchronize state changes with the UnSignal.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment seems to be purely informative, explaining what 'unEffect' is doing in the code. It doesn't provide a suggestion, ask for confirmation, or point out a potential issue. Therefore, it violates the rule against purely informative comments.
6. packages/unuse-solid/src/index.ts:72
  • Draft comment:
    Switched from 'effect' to 'unEffect' for syncing signal updates in the Solid integration.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, describing a change made in the code without providing any actionable feedback or suggestions. It doesn't ask for confirmation or suggest improvements.
7. packages/unuse-solid/src/index.ts:144
  • Draft comment:
    Replaced 'effect' with 'unEffect' to update the Solid signal state within the unResolve function.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, explaining a change made in the code without providing any actionable feedback or suggestions. It doesn't ask for confirmation or suggest improvements.
8. packages/unuse-vue/src/index.ts:60
  • Draft comment:
    Using 'unEffect' instead of 'effect' to synchronize the Vue ref's value from the UnSignal.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, explaining a change in the code without suggesting any action or asking for clarification. It doesn't provide any actionable feedback or raise any concerns about the code change.
9. packages/unuse-vue/src/index.ts:127
  • Draft comment:
    Replaced 'effect' with 'unEffect' in the unResolve function to keep the Vue ref updated with the UnSignal.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, explaining a change made in the code without suggesting any improvements or asking for clarification. It doesn't align with the rules for useful comments.
10. packages/unuse/src/index.ts:10
  • Draft comment:
    Exports for 'unEffect' and 'unEffectScope' have been added to the public API, which aligns with the new abstraction goals.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, stating that exports have been added to the public API and aligns with abstraction goals. It doesn't provide any actionable feedback or suggestions for improvement.
11. packages/unuse/src/toUnSignal/index.ts:60
  • Draft comment:
    Replaced the direct 'effect' with 'unEffect' in the block handling signals with a 'set' property to ensure consistent reactivity.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
12. packages/unuse/src/toUnSignal/index.ts:94
  • Draft comment:
    Replaced 'effect' with 'unEffect' for state synchronization in the React-specific branch of toUnSignal.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, describing a change made in the code without providing any actionable feedback or suggestions. It doesn't ask for confirmation or suggest improvements, nor does it highlight any potential issues with the change.
13. packages/unuse/src/unEffect/index.ts:5
  • Draft comment:
    New 'unEffect' wrapper correctly delegates to alien-signals' effect. This abstraction allows future enhancements.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, describing what the new 'unEffect' wrapper does and its potential for future enhancements. It doesn't provide any actionable feedback or suggestions for improvement.
14. packages/unuse/src/unEffectScope/index.ts:5
  • Draft comment:
    New 'unEffectScope' wrapper abstracts over alien-signals' effectScope, paving the way for future customizations.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, describing a new wrapper and its potential for future customizations. It doesn't provide any actionable feedback or suggestions for improvement.
15. packages/unuse/src/unResolve/index.ts:113
  • Draft comment:
    In the Angular branch of unResolve, 'effect' was replaced with 'unEffect' to keep the state in sync; verify that dependency tracking is preserved.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify that dependency tracking is preserved, which violates the rule against asking for confirmation or verification. It does not provide a specific suggestion or point out a specific issue.
16. packages/unuse/src/unResolve/index.ts:162
  • Draft comment:
    Within the React branch, switching to 'unEffect' ensures that state updates from UnSignal are applied consistently.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment seems to be purely informative, explaining what a change does without suggesting any action or asking for clarification. It doesn't provide a suggestion or ask for confirmation about the intention behind the change.
17. packages/unuse/src/unResolve/index.ts:147
  • Draft comment:
    In the Solid branch, 'unEffect' is used to synchronize the signal state; confirm that this abstraction behaves as expected with Solid's reactivity.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
18. packages/unuse/src/unResolve/index.ts:217
  • Draft comment:
    For the Vue branch, replacing 'effect' with 'unEffect' maintains the synchronization between the Vue ref and the UnSignal.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment seems to be purely informative, explaining the effect of a change without suggesting any action or asking for confirmation. It doesn't align with the rules for useful comments.
19. packages/unuse/src/unWatch/index.ts:23
  • Draft comment:
    Replaced alien-signals' effect and effectScope with 'unEffect' and 'unEffectScope' to provide a unified abstraction for watching signal changes.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, explaining what changes were made without providing any actionable feedback or suggestions. It does not ask for confirmation or suggest improvements.

Workflow ID: wflow_5qgBsUWFcyD32fj4

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@Shinigami92 Shinigami92 marked this pull request as draft June 26, 2025 17:05
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

🧹 Nitpick comments (2)
packages/unuse/src/unEffect/index.ts (2)

5-7: Add JSDoc documentation for the public API.

Consider adding JSDoc comments to document the purpose and behavior of the unEffect function, especially since this is part of the public API.

+/**
+ * Creates a reactive effect that runs the provided callback function.
+ * This is a wrapper around the alien-signals effect function.
+ * 
+ * @param callback - The callback function to run reactively
+ * @returns A function to dispose the effect
+ */
 export function unEffect(callback: () => void): UnEffectReturn {
   return effect(callback);
 }

3-3: Consider more descriptive type naming.

The type UnEffectReturn could be more descriptive to align with the project's naming conventions.

-export type UnEffectReturn = () => void;
+export type UnEffectDisposer = () => void;

Then update the function signature accordingly:

-export function unEffect(callback: () => void): UnEffectReturn {
+export function unEffect(callback: () => void): UnEffectDisposer {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8b3c5d and da0226e.

📒 Files selected for processing (11)
  • .changeset/ten-melons-clap.md (1 hunks)
  • packages/unuse-angular/src/index.ts (3 hunks)
  • packages/unuse-react/src/index.ts (3 hunks)
  • packages/unuse-solid/src/index.ts (3 hunks)
  • packages/unuse-vue/src/index.ts (3 hunks)
  • packages/unuse/src/index.ts (1 hunks)
  • packages/unuse/src/toUnSignal/index.ts (5 hunks)
  • packages/unuse/src/unEffect/index.ts (1 hunks)
  • packages/unuse/src/unEffectScope/index.ts (1 hunks)
  • packages/unuse/src/unResolve/index.ts (5 hunks)
  • packages/unuse/src/unWatch/index.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (7)
packages/unuse/src/unWatch/index.ts (2)
packages/unuse/src/unEffectScope/index.ts (1)
  • unEffectScope (5-7)
packages/unuse/src/unEffect/index.ts (1)
  • unEffect (5-7)
packages/unuse-solid/src/index.ts (1)
packages/unuse/src/unEffect/index.ts (1)
  • unEffect (5-7)
packages/unuse-vue/src/index.ts (1)
packages/unuse/src/unEffect/index.ts (1)
  • unEffect (5-7)
packages/unuse/src/toUnSignal/index.ts (1)
packages/unuse/src/unEffect/index.ts (1)
  • unEffect (5-7)
packages/unuse/src/unResolve/index.ts (1)
packages/unuse/src/unEffect/index.ts (1)
  • unEffect (5-7)
packages/unuse-angular/src/index.ts (1)
packages/unuse/src/unEffect/index.ts (1)
  • unEffect (5-7)
packages/unuse-react/src/index.ts (1)
packages/unuse/src/unEffect/index.ts (1)
  • unEffect (5-7)
🪛 ESLint
packages/unuse/src/unEffectScope/index.ts

[error] 1-1: Unable to resolve path to module 'alien-signals'.

(import-x/no-unresolved)

packages/unuse/src/unEffect/index.ts

[error] 1-1: Unable to resolve path to module 'alien-signals'.

(import-x/no-unresolved)

🔇 Additional comments (21)
packages/unuse/src/unEffect/index.ts (1)

1-1: Verify the alien-signals dependency is properly configured.

The ESLint error indicates the 'alien-signals' module cannot be resolved. Ensure this dependency is properly installed and configured in the package.json.

#!/bin/bash
# Description: Check if alien-signals is properly configured as a dependency

# Check if alien-signals is listed in package.json dependencies
echo "Checking package.json files for alien-signals dependency:"
fd package.json --exec grep -l "alien-signals" {}

# Check if alien-signals is installed in node_modules
echo -e "\nChecking for alien-signals in node_modules:"
fd -t d alien-signals
.changeset/ten-melons-clap.md (1)

1-10: LGTM! Changeset documentation is well-structured.

The changeset correctly documents the new features and includes all affected packages with appropriate minor version bumps.

packages/unuse/src/index.ts (1)

10-11: LGTM! Export additions are correctly implemented.

The new exports for unEffect and unEffectScope are properly added and maintain the file's alphabetical ordering.

packages/unuse/src/toUnSignal/index.ts (2)

7-7: LGTM! Import update is correctly implemented.

The import change from alien-signals to the local unEffect module is correct and aligns with the PR objectives to encapsulate alien-signals behind the wrapper API.


66-68: LGTM! Consistent replacement of effect with unEffect.

All effect() calls have been correctly replaced with unEffect() across all framework implementations. The function signatures and behavior remain unchanged, ensuring backward compatibility.

Also applies to: 97-101, 134-136, 159-161

packages/unuse-vue/src/index.ts (2)

16-16: LGTM! Import update includes unEffect correctly.

The import statement properly includes unEffect from the 'unuse' package, consistent with the pattern used across other framework adapters.


61-63: LGTM! Consistent replacement of effect with unEffect in Vue adapter.

Both effect() calls have been correctly replaced with unEffect() in the Vue-specific reactive synchronization logic. The changes maintain the same behavior while using the new wrapper function.

Also applies to: 130-130

packages/unuse-angular/src/index.ts (3)

25-25: LGTM: Clean import update

The import change from effect to unEffect aligns with the PR objective of encapsulating alien-signals behind the scenes.


57-59: LGTM: Consistent usage update

The replacement of effect with unEffect maintains the same callback signature and behavior while using the new internal wrapper.


129-129: LGTM: Consistent usage update

The replacement of effect with unEffect is consistent with the other changes in this file and maintains the same reactive synchronization behavior.

packages/unuse-solid/src/index.ts (3)

26-26: LGTM: Import update aligns with refactor

The import change from effect to unEffect is consistent with the broader refactor across framework adapters.


72-74: LGTM: Consistent reactive effect usage

The replacement of effect with unEffect maintains the bidirectional reactivity between Solid signals and UnSignals.


147-147: LGTM: Consistent usage in unResolve

The unEffect usage properly maintains the reactive synchronization from UnSignal to Solid signal.

packages/unuse/src/unWatch/index.ts (2)

2-3: LGTM: Import updates support internal abstraction

The imports now use the internal unEffect and unEffectScope wrappers instead of directly importing from alien-signals, supporting the PR's encapsulation goal.


23-24: LGTM: Consistent usage of internal wrappers

The replacement of effectScope and effect with unEffectScope and unEffect maintains the same reactive watch behavior while using the new internal abstractions.

packages/unuse-react/src/index.ts (3)

23-23: LGTM: Import change supports encapsulation

The import update from effect to unEffect aligns with the consistent refactor across all framework adapters.


64-68: LGTM: Reactive synchronization maintained

The replacement of effect with unEffect preserves the bidirectional reactivity between React state and UnSignals.


145-153: LGTM: Consistent usage in unResolve

The unEffect usage maintains proper reactive synchronization from UnSignal to React state with the same conditional logic.

packages/unuse/src/unEffectScope/index.ts (1)

1-7: I’d like to confirm that the declared version in your package and the version locked in pnpm match up. Let’s inspect your packages/unuse/package.json, the root package.json, and the pnpm-lock.yaml entries for alien-signals:

#!/bin/bash
echo "▶ packages/unuse/package.json dependencies:"
grep -R '"alien-signals"' -n packages/unuse/package.json || echo "  – not found in packages/unuse/package.json"

echo -e "\n▶ Root package.json dependencies:"
grep -R '"alien-signals"' -n package.json || echo "  – not found in root package.json"

echo -e "\n▶ Locked versions in pnpm-lock.yaml:"
grep -R -n "alien-signals@" pnpm-lock.yaml | head -n 20 || echo "  – pnpm-lock.yaml missing entries for alien-signals"
packages/unuse/src/unResolve/index.ts (2)

15-15: LGTM! Import change aligns with PR objectives.

The import has been correctly updated to use the new internal unEffect wrapper instead of directly importing effect from alien-signals.


113-113: LGTM! Function calls successfully migrated to internal wrapper.

All effect function calls have been consistently replaced with unEffect across all framework adapters (Angular, React, Solid, Vue). Since unEffect is a simple wrapper around the original effect function, this maintains functional equivalence while achieving the PR objective of encapsulating alien-signals behind internal wrappers.

Also applies to: 162-162, 206-206, 217-217

@Shinigami92 Shinigami92 marked this pull request as ready for review June 26, 2025 17:09
Copy link
Contributor
@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 4aa9125 in 1 minute and 41 seconds. Click for details.
  • Reviewed 379 lines of code in 15 files
  • Skipped 1 files when reviewing.
  • Skipped posting 13 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .changeset/ten-melons-clap.md:1
  • Draft comment:
    Changelog clearly documents the addition of unEffect and unEffectScope wrappers.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. packages/unuse-angular/package.json:29
  • Draft comment:
    Removed direct dependency on 'alien-signals'; ensure centralized management via the 'unuse' package.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
3. packages/unuse-angular/src/index.ts:57
  • Draft comment:
    Angular integration: Using unEffect for reactive syncing is consistent with the new abstraction.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment seems to be purely informative, as it is just stating that using unEffect is consistent with a new abstraction. It doesn't provide any actionable feedback or suggestions for improvement.
4. packages/unuse-react/package.json:29
  • Draft comment:
    Removed direct dependency on 'alien-signals' from React integration.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, stating that a direct dependency on 'alien-signals' was removed from React integration. It doesn't provide any actionable feedback or suggestions for improvement.
5. packages/unuse-react/src/index.ts:64
  • Draft comment:
    React integration: The unEffect wrapper is now used for state synchronization, ensuring consistent updates.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, explaining what the unEffect wrapper does in the context of React integration. It doesn't provide any actionable feedback or suggestions for improvement.
6. packages/unuse-solid/src/index.ts:72
  • Draft comment:
    Solid integration: Using unEffect for reactive updates ensures consistency across frameworks.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative and does not provide any actionable feedback or suggestions for improvement. It simply states an observation about the code without offering any guidance or raising any concerns.
7. packages/unuse-vue/src/index.ts:60
  • Draft comment:
    Vue integration: The unEffect wrapper is appropriately used to update ref values.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative and does not provide any actionable feedback or suggestions for improvement. It simply states that something is used appropriately, which does not align with the rules for useful comments.
8. packages/unuse/src/index.ts:10
  • Draft comment:
    Central exports now include unEffect and unEffectScope, providing a uniform reactivity abstraction.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
9. packages/unuse/src/toUnSignal/index.ts:47
  • Draft comment:
    toUnSignal: Replacing direct effect calls with unEffect ensures consistent reactive behavior.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
10. packages/unuse/src/unEffect/index.ts:5
  • Draft comment:
    New unEffect wrapper: a thin abstraction over alien-signals' effect, setting the stage for future enhancements.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
11. packages/unuse/src/unEffectScope/index.ts:5
  • Draft comment:
    New unEffectScope wrapper: a straightforward abstraction over alien-signals' effectScope.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
12. packages/unuse/src/unResolve/index.ts:113
  • Draft comment:
    unResolve: Switching to unEffect for reactive synchronization provides consistent behavior across different frameworks.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative and does not provide any actionable feedback or suggestions for improvement. It simply states a fact about the change without asking for confirmation or suggesting an alternative.
13. packages/unuse/src/unWatch/index.ts:23
  • Draft comment:
    unWatch: The use of unEffectScope and unEffect for change observation is clear and consistent.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment seems to be purely informative, as it is simply stating that the use of certain functions is clear and consistent. It does not provide any actionable feedback or suggestions for improvement.

Workflow ID: wflow_QjjGL6t3YrQdTnoh

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@Shinigami92 Shinigami92 merged commit 18c3e78 into main Jun 26, 2025
15 checks passed
@Shinigami92 Shinigami92 deleted the feat-unEffect branch June 26, 2025 17:29
@coderabbitai coderabbitai bot mentioned this pull request Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0