Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.5.3 call non-existing function when configured with JSON #98

Closed
jhosteny opened this issue Jan 28, 2025 · 2 comments · Fixed by #99
Closed

Version 1.5.3 call non-existing function when configured with JSON #98

jhosteny opened this issue Jan 28, 2025 · 2 comments · Fixed by #99

Comments

@jhosteny
Copy link
Contributor

LiveSelect and LiveView versions
1.5.3 / 1.0.2
Elixir 1.18.1
Erlang 27.2

Describe the bug
The library calls json.encode in the "selection_recovery" event, where json is obtained via Phoenix.json_library. However, the builtin JSON module does not provide an encode function, only encode!.

Expected behavior
Selection recovery succeeds

Actual behavior
Selection recovery fails because of the invalid function call

Screenshots

Image

If applicable (in most cases it is), do add a screenshot (or even better, a GIF or a video) that describes the problem.

Browsers
On which browsers did you notice the issue?

Issue Repo
You have the best chances of someone fixing the issue if you include a minimal repo that reproduces the problem.

Additional context
Add any other context about the problem here.

jhosteny added a commit to thoroai/live_select that referenced this issue Jan 28, 2025
Ensure that we call a version of encode that exists for both the Jason
library, and new builtin JSON module.

Fixes maxmarcon#98
@maxmarcon
Copy link
Owner

Hi @jhosteny and thank you so much for reporting this and creating a PR 🎉

I have to ask, since I'm not using Elixir anymore and I'm not up-to-date with the latest Phoenix/LV developments, what is the default JSON module that Phoenix.json_library() returns? Obviously not Jason, but also not this one either, because that one seems to have an encode function.

I searched a bit and I couldn't find an answer, maybe you can help me here. Thanks again.

@maxmarcon
Copy link
Owner

Ok I got it, I think it's returning this module

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 a pull request may close this issue.

2 participants