Skip to content

Conversation

abiriadev
Copy link

@abiriadev abiriadev commented Oct 21, 2025

As stated in State document, it has entrypoint named store and doesn't expose any other properties directly under the Context.

so it must be store.count, instead of count, in order to actually reflect the change(++) back to the store.

Summary by CodeRabbit

  • Documentation
    • Updated tutorial examples to show using the shared store object in handlers and routes: handlers now access and update state via the store, and examples return the store's updated value so routes reflect shared state changes.

As stated in [`State`](https://elysiajs.com/patterns/extends-context.html#state) document, it has entrypoint named `store` and doesn't expose any other properties _directly_ under the Context.

so it must be `store.count`, instead of `count`, in order to actually reflect the change(`++`) back to the store.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 21, 2025

Walkthrough

The State pattern example was updated to use the handler's store object instead of destructuring count; the route now increments and returns store.count directly.

Changes

Cohort / File(s) Change Summary
State Pattern Documentation Update
docs/tutorial/patterns/extends-context/index.md
Handler parameter changed from ({ count }) to ({ store }); increment changed from count++ to store.count++; return value changed from count to store.count.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant RouteHandler
    participant Store

    Client->>RouteHandler: HTTP request
    Note over RouteHandler,Store: Handler receives `{ store }`
    RouteHandler->>Store: read store.count
    RouteHandler->>Store: store.count = store.count + 1
    RouteHandler->>Client: respond with store.count
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A hop, a tweak, the store in view,
No sliced-out count — just one path true.
I nudge the number, then show it proud,
A tiny change, a lesson loud. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "fix: code error on 'extends context' tutorial" is directly related to the main change in the changeset. The PR corrects code errors in the extends context tutorial's State document by updating how the store is accessed in the example code (changing from count to store.count). The title is specific enough to identify the tutorial section affected, uses clear action language ("fix"), and avoids vague terminology. It accurately captures the primary purpose of the changes without unnecessary noise.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 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 764e6a6 and 0af6b4c.

📒 Files selected for processing (1)
  • docs/tutorial/patterns/extends-context/index.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
docs/tutorial/patterns/extends-context/index.md

72-72: Hard tabs
Column: 1

(MD010, no-hard-tabs)


73-73: Hard tabs
Column: 1

(MD010, no-hard-tabs)


75-75: Hard tabs
Column: 1

(MD010, no-hard-tabs)


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21bbd06 and 764e6a6.

📒 Files selected for processing (1)
  • docs/tutorial/patterns/extends-context/index.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
docs/tutorial/patterns/extends-context/index.md

72-72: Hard tabs
Column: 1

(MD010, no-hard-tabs)


73-73: Hard tabs
Column: 1

(MD010, no-hard-tabs)


75-75: Hard tabs
Column: 1

(MD010, no-hard-tabs)

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