-
Notifications
You must be signed in to change notification settings - Fork 54
fix: recs getEventMessages #443
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
Conversation
WalkthroughThis update applies patch releases to several Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant StateModule
Client->>StateModule: Call getEvents or getEntitiesQuery(limit)
loop While continueFetching
StateModule->>StateModule: Fetch batch of items
alt Items.length < limit and no next_cursor
StateModule->>StateModule: Set continueFetching = false
StateModule-->>Client: Return accumulated results
else Items.length < limit or no items
StateModule->>StateModule: Set continueFetching = false
StateModule-->>Client: Return accumulated results
else
StateModule->>StateModule: Continue fetching with next_cursor
end
end
Possibly related PRs
Poem
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (1)
packages/state/src/recs/index.ts (1)
247-251
: Consider using proper logging levels for diagnostic messages.While the added debug logs are useful for diagnosing the fix, they're using
console.error()
for non-error information. This could be confusing when reviewing logs.- console.error("STOP FETCHING"); + if (logging) console.log("Stopping fetch: No more items"); ... - console.error("NEXT_CURSOR", entities.next_cursor); + if (logging) console.log("Using next cursor:", entities.next_cursor);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.changeset/afraid-berries-go.md
(1 hunks)packages/predeployed-connector/package.json
(1 hunks)packages/state/src/recs/index.ts
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build
- GitHub Check: check
🔇 Additional comments (5)
packages/predeployed-connector/package.json (1)
67-71
: Added StarkNet and React dependencies to align with peer dependencies.The added dependencies match the existing peer dependencies, which is a good practice for a React-based package. This ensures compatibility between the package's code and its consumers.
packages/state/src/recs/index.ts (3)
241-244
: Fix for infinite loop in getEvents by adding early termination condition.This change correctly adds an early termination condition to stop fetching when both criteria are met: the number of items is less than the requested limit AND there's no next cursor. This prevents unnecessary additional requests and potential infinite loops.
291-303
: Moved fetch call inside the loop for consistency.Moving the fetch call inside the loop in
getEntitiesQuery
improves code consistency with other similar functions and simplifies the control flow.
311-317
: Added consistent termination condition in getEntitiesQuery.This change implements the same loop termination logic as in
getEvents
, ensuring consistent behavior between both functions when dealing with paginated results. Good for maintainability and preventing infinite loops..changeset/afraid-berries-go.md (1)
1-16
: Appropriate changelog for the fix across multiple packages.The changeset correctly identifies all affected packages and provides a clear description of the fix, which matches the code changes we've seen.
Closes #
Introduced changes
Checklist
Summary by CodeRabbit
Bug Fixes
Chores