Skip to content

Fix instance switching when resolver returns a list#161

Merged
sorentwo merged 2 commits intooban-bg:mainfrom
RobinBoers:main
Feb 18, 2026
Merged

Fix instance switching when resolver returns a list#161
sorentwo merged 2 commits intooban-bg:mainfrom
RobinBoers:main

Conversation

@RobinBoers
Copy link
Copy Markdown
Contributor

handle_event("select-instance") compared name (a string — the inspected atom from phx-value) against allowed (atoms from resolve_instances/1), so Enum.member?/2 always returned false and switching silently did nothing.

Fix: convert name back to an atom via Module.safe_concat/1 before the membership check, consistent with how handle_info({:select_instance, name}) already handles the same value.

This PR may or may not have been written by @claude.

handle_event("select-instance") compared name (a string — the inspected
atom from phx-value) against allowed (atoms from resolve_instances/1),
so Enum.member?/2 always returned false and switching silently did nothing.

Fix: convert name back to an atom via Module.safe_concat/1 before the
membership check, consistent with how handle_info({:select_instance, name})
already handles the same value.
@sorentwo
Copy link
Copy Markdown
Member

This should go the other way, ensure it is a string and comparing against a list of strings, rather than converting to an atom. There isn't a guarantee that the attempted instance is actually an atom anyhow (an instance can have any type of term as a name).

@sorentwo sorentwo merged commit 7302974 into oban-bg:main Feb 18, 2026
2 checks passed
@sorentwo
Copy link
Copy Markdown
Member

Thanks for the fix!

@sorentwo sorentwo added the kind:bug Something isn't working label Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants