Sha256: fa3215a3212e3a3f038fabcee6b73be6dd78fcb3bf8852abefc4ac08667cb052
Contents?: true
Size: 843 Bytes
Versions: 26
Compression:
Stored size: 843 Bytes
Contents
module Isomorfeus module Data module Reducer def self.add_reducer_to_store data_reducer = Redux.create_reducer do |prev_state, action| action_type = action[:type] if action_type.JS.startsWith('DATA_') case action_type when 'DATA_STATE' if action.key?(:set_state) action[:set_state] else prev_state end when 'DATA_LOAD' prev_state.deep_merge(action[:data]) else prev_state end else prev_state.nil? ? {} : prev_state end end Redux::Store.preloaded_state_merge!(data_state: {}) Redux::Store.add_reducer(data_state: data_reducer) end end end end
Version data entries
26 entries across 26 versions & 1 rubygems