Skip to content

fix: initialize user_can_view before conditional block#2776

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

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

@github-actions
Copy link

This PR is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Feb 22, 2026
@dokterbob
Copy link
Collaborator

Dup of #2775

@dokterbob dokterbob closed this Feb 23, 2026
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. stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed

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)

2 participants