SelectoComponents.Form.ParamsState (selecto_components v0.4.5)

Handles bidirectional conversion between URL parameters and application state for SelectoComponents forms.

This module manages:

  • Converting view configuration to URL parameters
  • Parsing URL parameters back to view state
  • Processing filters and view-specific parameters
  • Executing queries with error handling
  • Managing URL state updates

Link to this section Summary

Functions

Clears cached query pagination state.

Convert saved view configuration to full params format.

Build view_config from URL params, updating only filter state.

Check if filter structure changed (not just values).

Convert filters back to params format.

Build view_config from a submitted form payload.

Normalize parameter maps for comparison.

Build view_config from URL params, updating full state including view-specific configs.

Restore a saved-view payload into socket state.

Update the URL to include the configured view parameters.

Normalize submitted form params so submit uses the browser form state as truth.

Convert view_config structure to URL parameters format.

Convert full view_config structure to saved-view persistence format.

Process filters from params, extracting and sorting them.

Execute view from URL parameters, handling query execution and error cases.

Version of view_from_params that applies sorting.

Check if view parameters have changed significantly enough to require a view reset.

Check if view-specific parameters changed.

Link to this section Functions

Link to this function

assign_view_config(socket, view_config)

Link to this function

canonicalize_form_params(params)

Link to this function

clear_query_caches(socket)

Clears cached query pagination state.

This is used when a user explicitly re-submits or reloads a view so results are recomputed from fresh execution instead of page-cache reuse.

Link to this function

convert_saved_config_to_full_params(saved_params, view_type)

Convert saved view configuration to full params format.

Link to this function

filter_params_to_state(params, socket)

Build view_config from URL params, updating only filter state.

Link to this function

filter_structure_changed?(params, used_params)

Check if filter structure changed (not just values).

Link to this function

filters_to_params(filters)

Convert filters back to params format.

Link to this function

form_params_to_state(params, socket)

Build view_config from a submitted form payload.

Unlike URL params, the form payload contains inputs for all rendered view tabs, so every view can be reconstructed from the browser state in one pass.

Link to this function

mark_form_state_applied(socket)

Link to this function

normalize_param_map(param_map)

Normalize parameter maps for comparison.

Link to this function

params_to_state(params, socket)

Build view_config from URL params, updating full state including view-specific configs.

Link to this function

saved_params_to_state(saved_params, socket)

Restore a saved-view payload into socket state.

Link to this function

state_to_url(params, socket, opts \\ [])

Update the URL to include the configured view parameters.

Link to this function

submitted_form_params(params)

Normalize submitted form params so submit uses the browser form state as truth.

Link to this function

view_config_to_params(view_config)

Convert view_config structure to URL parameters format.

Link to this function

view_config_to_saved_params(view_config)

Convert full view_config structure to saved-view persistence format.

Link to this function

view_filter_process(params, item_name)

Process filters from params, extracting and sorting them.

Link to this function

view_from_params(params, socket)

Execute view from URL parameters, handling query execution and error cases.

This is the core function that:

  1. Parses URL parameters into a view configuration
  2. Applies filters to the Selecto structure
  3. Executes the query
  4. Handles errors gracefully
  5. Updates socket state with results or errors
Link to this function

view_from_params_with_sort(params, socket, sort_by)

Version of view_from_params that applies sorting.

Link to this function

view_params_changed?(params, socket)

Check if view parameters have changed significantly enough to require a view reset.

Link to this function

view_specific_params_changed?(params, used_params, param_key)

Check if view-specific parameters changed.