Skip to content

fix: initialize user_can_view before conditional block#2776

Open
thecaptain789 wants to merge 1 commit intoChainlit:mainfrom
thecaptain789:fix/user-can-view-unbound
Open

fix: initialize user_can_view before conditional block#2776
thecaptain789 wants to merge 1 commit intoChainlit:mainfrom
thecaptain789:fix/user-can-view-unbound

Conversation

@thecaptain789
Copy link

@thecaptain789 thecaptain789 commented Feb 7, 2026

Fixes #2766

When @cl.on_shared_thread_view hook is not defined, user_can_view was never initialized, causing an UnboundLocalError when the variable was referenced.

This initializes user_can_view = False before the conditional block to provide a safe default.


Summary by cubic

Initialize user_can_view = False in get_shared_thread to avoid UnboundLocalError when on_shared_thread_view isn’t defined.

Written for commit f145ceb. Summary will update on new commits.

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. backend Pertains to the Python backend. bug Something isn't working labels Feb 7, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Pertains to the Python backend. bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UnboundLocalError: user_can_view referenced before assignment when on_shared_thread_view hook is not set (2.9.6)

1 participant