8000 Refactor: introduce function property overrides for lifecycle methods by hkusu · Pull Request #74 · yumemi-inc/Tart · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Refactor: introduce function property overrides for lifecycle methods #74

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 9 commits into from
Mar 28, 2025

Conversation

hkusu
Copy link
Member
@hkusu hkusu commented Mar 26, 2025

Summary

  • Introduces function properties for lifecycle methods (onEnter, onExit, onDispatch, onError)
  • Marks old method implementations as deprecated
  • Removes redundant parameter names in function types
  • Updates tests to use the new function property approach
  • Introduces StoreContext interface to improve the Middleware API and store function properties
  • Refactors Middleware.onInit to receive StoreContext instead of separate Store and CoroutineContext
  • Updates Message API to use extension property instead of extension function

Test plan

  • All existing tests pass without changes
  • Ensures compatibility between old and new APIs

🤖 Generated with Claude Code

@hkusu hkusu force-pushed the refactor/function-properties branch from c518712 to a93ff72 Compare March 26, 2025 11:14
@hkusu hkusu force-pushed the refactor/function-properties branch from f4a0ff3 to c154d6e Compare March 27, 2025 08:33
@hkusu hkusu force-pushed the refactor/function-properties branch from 747257e to 7bbe41b Compare March 28, 2025 07:06
@hkusu
Copy link
Member Author
hkusu commented Mar 28, 2025

Overall feedback

This PR represents a significant improvement to the Tart architecture and API ergonomics. The introduction of the \ interface provides a more organized way to access store functionality from lifecycle methods and middleware. The transitions from class inheritance to function parameters and from direct access to context-based access are well-executed.

Strengths

  • Improved API design with function properties instead of method overrides
  • Cleaner separation of concerns with the \ interface
  • More consistent parameter passing throughout the codebase
  • Better encapsulation of internal store implementation details
  • Comprehensive documentation updates in the README

Suggestions for future improvements

  • Consider adding more examples in the documentation for handling complex state transitions
  • The Message API could benefit from additional examples showing how to use it with the new \

Overall, this is a well-executed refactoring that improves both the internal architecture and the developer experience. The code is cleaner, more consistent, and better encapsulated.

@hkusu
Copy link
Member Author
hkusu commented Mar 28, 2025

Overall feedback

This PR represents a significant improvement to the Tart architecture and API ergonomics. The introduction of the \ interface provides a more organized way to access store functionality from lifecycle methods and middleware. The transitions from class inheritance to function parameters and from direct access to context-based access are well-executed.

Strengths

  • Improved API design with function properties instead of method overrides
  • Cleaner separation of concerns with the \ interface
  • More consistent parameter passing throughout the codebase
  • Better encapsulation of internal store implementation details
  • Comprehensive documentation updates in the README

Suggestions for future improvements

  • Consider adding more examples in the documentation for handling complex state transitions
  • The Message API could benefit from additional examples showing how to use it with the new \

Overall, this is a well-executed refactoring that improves both the internal architecture and the developer experience. The code is cleaner, more consistent, and better encapsulated.

🤖 Generated with Claude Code

@hkusu hkusu force-pushed the refactor/function-properties branch from a179e3d to ab4c37a Compare March 28, 2025 07:38
@hkusu hkusu enabled auto-merge March 28, 2025 07:40
@hkusu hkusu merged commit 4efa33a into main Mar 28, 2025
3 checks passed
@hkusu hkusu deleted the refactor/function-properties branch March 28, 2025 07:45
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
0