Question: Reflux is not triggering the render

Question

Reflux is not triggering the render

Answers 0
Added at 2016-04-15 05:04
Tags
Question

The component go to the action inside the stores, changes the state and then it try to trigger the render with this.trigger(this.state); but nothing happens.

/* Module dependencies */

import Reflux from 'reflux';
import HeaderActions from '../actions/header';
import { sia } from '../../lib';

export default Reflux.createStore({
  listenables: [HeaderActions],

  init: function () {
    this.state = {
      code: 'bog',
      name: 'Bogotá',
      url: 'sia.bogota.unal.edu.co',
      plan: { level: '', code: '', name: 'SIN PLAN DE ESTUDIOS' }
    };
  },

  getInitialState: function () {
    return this.state;
  },

  changeSite: function (code, url) {
    this.state.code = code;
    this.state.name = sia.NAME[code];
    this.state.url = url;
    this.state.plan = { level: '', code: '', name: 'SIN PLAN DE ESTUDIOS' };
    console.log(this.state);
    this.trigger(this.state);
  },

  changePlan: function (level, code, name) {
    this.state.plan.level = level;
    this.state.plan.code = code;
    this.state.plan.name = name;
    console.log(this.state);
    this.trigger(this.state);
  }
});

The compononet reads the store state with this.state.AppStore... it changes inside store but not render.

Answers
Source Show
◀ Wstecz