Skip to content

Fix composable invocation and try-catch errors#40

Draft
scorp867 wants to merge 1 commit into
cursor-edit2from
cursor/fix-composable-invocation-and-try-catch-errors-6202
Draft

Fix composable invocation and try-catch errors#40
scorp867 wants to merge 1 commit into
cursor-edit2from
cursor/fix-composable-invocation-and-try-catch-errors-6202

Conversation

@scorp867

Copy link
Copy Markdown
Owner

Replace LocalContext.current with captured context to resolve Compose errors in LaunchedEffect.

The errors "Try catch is not supported around composable function invocations" and "@composable invocations can only happen from the context of a @composable function" occurred because LocalContext.current is a composable function call, and it was being invoked inside a LaunchedEffect block, which is a non-composable coroutine context, and also within a try-catch block. By using the context variable, which is already captured at the composable scope, we avoid making a composable call in an invalid context.


Open in Cursor Open in Web

Co-authored-by: teesmaarkhan867 <teesmaarkhan867@gmail.com>
@cursor

cursor Bot commented Aug 30, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

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