Unlocking Faster Mobile UI with Fish-Redux 2.0’s Dynamic FlowAdapter
This article explains how Fish-Redux has been adopted across Xianyu’s core mobile flows, the limitations of its original static and dynamic adapters, and the architectural evolution that led to a unified FlowAdapter delivering dynamic page composition, component reuse, AB testing and improved developer productivity.
Background
Since its open‑source release, Fish‑Redux has been extensively validated on Xianyu’s core mobile links, starting from product detail pages to publishing pages. The framework’s component‑reuse and state‑management capabilities have dramatically increased development efficiency and reduced code redundancy.
Challenges
As page complexity grew, the existing static composition and limited flexibility could no longer meet new business scenarios. Specific pain points included page layout, dynamic A/B testing, and insufficient flexibility.
Existing Adapters
StaticFlowAdapter
StaticFlowAdapter({
@required List<Dependent<T>> slots,
Reducer<T> reducer,
Effect<T> effect,
ReducerFilter<T> filter,
})
// Dependent = connector + componentThe StaticFlowAdapter determines page order through a fixed list of Dependent objects, directly controlling data flow between sub‑components. While it simplifies complex page logic, it cannot modify slots at runtime, lacking dynamic composition.
DynamicFlowAdapter
final Map<String, AbstractLogic<Object>> pool;
final AbstractConnector<T, List<ItemBean>> connector;
DynamicFlowAdapter({
@required this.pool,
@required this.connector,
ReducerFilter<T> filter,
Reducer<T> reducer,
Effect<T> effect,
@deprecated Object Function(T) key,
})DynamicFlowAdapter introduces a “pool” of component instances and a connector that maps data sources to UI components, enabling data‑driven dynamic page lists. However, consolidating all data handling into a single connector weakens the framework’s data‑partitioning advantage.
Evolution to FlowAdapter
To combine dynamic composition with data partitioning, a new unified FlowAdapter was created. It replaces both static and dynamic adapters, offering:
Unified API for component registration and data source handling.
Section concept to support heterogeneous data collections.
Dynamic ordering via FlowDependencies callbacks, enabling runtime A/B and template switching.
Dependent objects now act as a bridge of connector (data description) + component (UI config), preserving the original data‑partitioning benefits while allowing the adapter to fetch its component list dynamically.
Key Features
Dynamic composition: page order and displayed data are driven by server‑side configuration.
Component AB testing: server‑side pre‑processing or client‑side code can swap components based on buckets.
Dynamic templates: allow rapid online validation of new business modules without client releases.
After the upgrade, Xianyu’s detail and publishing flows were refactored to use the new FlowAdapter, reducing code duplication and improving maintainability.
Future Outlook
The unified FlowAdapter will be merged into the official Fish‑Redux release, with plans to extend support to other container types such as waterfall layouts and to provide adapters for PowerScrollView.
Developers are encouraged to try the updated Fish‑Redux, contribute to the community, and explore the new extension packages.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
