Skip to content

Conversation

@SyedaAnshrahGillani
Copy link

  • Problem: fetchSubscriptionStatus never awaited the response from Autumn. check, so every plan was labeled as not allowed and missing status, even when data was returned. This meant the UI always treated users as having no active product.

  • Fix: Await each autumn. Check call before reading res.data, ensuring the fetched subscription status actually reflects the backend response.

Comment on lines 23 to 29
await Promise.all(
allPlans.map(async (plan) => {
try {
const res = autumn.check({
const res = await autumn.check({
productId: plan,
})
const allowed = res.data?.allowed ?? false
Copy link

Choose a reason for hiding this comment

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

Bug: The autumn.check() call is not awaited in fetchMemoriesFeature and other similar functions, causing them to return undefined instead of the expected data.
Severity: MEDIUM

Suggested Fix

Add the await keyword to the autumn.check() call in all affected functions (fetchMemoriesFeature, fetchConnectionsFeature, fetchConsumerProProduct, fetchProProduct) to ensure the promise resolves before accessing the .data property. For example, change const res = autumn.check(...) to const res = await autumn.check(...).

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: packages/lib/queries.ts#L23-L29

Potential issue: In several query functions, including `fetchMemoriesFeature`,
`fetchConnectionsFeature`, `fetchConsumerProProduct`, and `fetchProProduct`, the
asynchronous call to `autumn.check()` is not awaited. This causes the `res` variable to
be a Promise object instead of the resolved value. Consequently, `res.data` evaluates to
`undefined`. Downstream hooks and components that consume these functions, such as
`use-memories-usage.ts`, then receive `undefined` data. This leads to incorrect UI
displays, like showing resource usage as "0 / 0" instead of the actual values, which can
mislead users about their account status and limits.

Did we get this right? 👍 / 👎 to inform future reviews.

@graphite-app graphite-app bot requested a review from Dhravya January 26, 2026 18:06
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.

2 participants