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

Remove list guard in Plug.Conn.merge_assigns and merge_private #1152

Merged
merged 2 commits into from
Jun 24, 2023

Conversation

hissssst
Copy link
Contributor

Just a more flexible solution

@josevalim
Copy link
Member

Can you please provide examples of use cases?

@hissssst
Copy link
Contributor Author

I don't know why this limitation exists in the first place, I haven't found anything about this in original PR or commit messages

Here's an example from my codebase

static_assigns = static_assigns()
dynamic_assigns = 
  categories_assigns
  |> Map.merge(item_assigns)
  |> Map.merge(brands_assigns)
  |> Map.merge(overrides)
  |> Enum.to_list() # This is unnecessary

conn
|> merge_assigns(static_assigns)
|> merge_assigns(dynamic_assigns)

@whatyouhide
Copy link
Member

I'm ok with a generic enumerable, but the Enumerable.t/1 type is a recent addition to Elixir. You'll have to use Enumerable.t() here. 🙃

lib/plug/conn.ex Outdated Show resolved Hide resolved
lib/plug/conn.ex Outdated Show resolved Hide resolved
Copy link
Member

@whatyouhide whatyouhide left a comment

Choose a reason for hiding this comment

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

I'm ok with this, @josevalim your call though! 🙃

@hissssst
Copy link
Contributor Author

@whatyouhide @josevalim ping

@josevalim josevalim merged commit 7b859ef into elixir-plug:main Jun 24, 2023
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

bradhanks pushed a commit to bradhanks/plug that referenced this pull request Sep 13, 2023
…r-plug#1152)

    drop  3627b20 Changed from passive to active voice, edited for consistency and conciseness
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.

4 participants