Skip to content

0.26.2

Latest

Choose a tag to compare

@woylie woylie released this 10 Aug 12:50
· 6 commits to main since this release
Immutable release. Only release title and notes can be modified.
9140a37

Changed

  • Raise an ArgumentError instead of a FunctionClauseError in
    Flop.Phoenix.page_link_range/3 if the page link option is neither :all,
    :none nor a positive integer.
  • Raise an ArgumentError instead of a FunctionClauseError in
    Flop.Phoenix.Pagination.new/2 if the Flop struct has no pagination
    parameters.
  • Document how to handle _unused_* and _target parameters produced by
    Phoenix forms.

Fixed

  • Return one entry per message in the errors of a form built from a
    Flop.Meta struct, so that form[:page].errors is [{message, opts}]
    instead of [[{message, opts}]].
  • Derive the input type of a filter from the Ecto type of the field even if the
    meta struct has errors, instead of falling back to a text input.
  • Replace existing Flop query parameters in Flop.Phoenix.build_path/3 when
    the path is given as a URL string, instead of appending a second set of them.
  • Render the hidden inputs of each filter once instead of twice in
    Flop.Phoenix.filter_fields/1.
  • Set ellipsis_start? and ellipsis_end? to false in
    Flop.Phoenix.Pagination.new/2 when page_links is :none.
  • Resolve Flop options from the backend module set on the meta struct, not only
    from the schema.
  • Render the configured filter fields instead of raising a
    FunctionClauseError if the filters parameter is not a list of maps.
  • Remove Flop query parameters that the Flop struct does not set from a path
    given as a URL string in Flop.Phoenix.build_path/3.
  • Omit pagination, order and filter parameters that match a default from the
    hidden inputs of a form built from a Flop.Meta struct that has validation
    errors.
  • Do not render the hidden _persistent_id inputs that
    Phoenix.Component.inputs_for/1 adds in Flop.Phoenix.filter_fields/1.
  • Flop.Phoenix.filter_fields/1 with dynamic={true} raised a
    FunctionClauseError if the meta struct had validation errors.

How to upgrade

If you flattened the errors yourself before rendering them, you can remove that
step. In the input component mix phx.new generates, that is:

- |> assign(:errors, Enum.map(List.flatten(field.errors), &translate_error/1))
+ |> assign(:errors, Enum.map(field.errors, &translate_error/1))