为什么我的 Fluxible 商店不会脱水?

Why won't my Fluxible store dehydrate?

我有一个非常简单的 Fluxible 商店:

export default class NoteStore extends BaseStore {
  static storeName = "NoteStore";

  static handlers = {
    [Actions.NEW_NOTES_FETCHED]: 'handleNewNotes'
  };

  constructor(dispatcher) {
    super(dispatcher);
    this.notes = [];
  }

  handleNewNotes(notes) {
    this.notes = [];
    var i;
    for (i = 0; i < notes.length; i++){
      this.notes.push(notes[i].content);
    }
    this.emitChange();
  }

  /* ... */

  dehydrate() {
    return { notes: this.notes };
  }

  rehydrate(state) {
    this.notes = state.notes;
  }

  // Shouldn't be necessary to override?
  shouldDehydrate() {
    return true;
  }
}

NEW_NOTES_FETCHED 由从我的后端 API 获取数据的操作调度,存储监听该事件并从负载中提取数据。据我所知,所有这一切都在起作用,因为当 运行 在客户端中时,一切都运行完美。

我遇到的问题是当服务器调用 app.dehydrate() 时,NoteStore 似乎没有脱水。我查看了页面中嵌入的 JSON,但我在任何地方都看不到我的商店,尽管我确实看到了 RouteStore 的信息。

我在 FluxibleContext 中注册了我的商店,但我是否需要额外执行一些操作才能将其添加到脱水链中?

应用引导代码(如果相关):

const app = new Fluxible({ component: Root });

const AppRouteStore = RouteStore.withStaticRoutes(routes);
app.registerStore(AppRouteStore);  // AppRouteStore appears in dehydrated JSON

app.registerStore(HtmlHeadStore); // Neither of these do, though HtmlHeadStore doesn't need to
app.registerStore(NoteStore);

export default app;

好的,我知道出了什么问题。基本上,应该调度 NEW_NOTES_FETCHED 事件的操作没有返回承诺,因此处理来自后端服务器的响应的逻辑实际上从未 运行,即使请求本身已经发出我看到它出现在后端的日志中。

我纠结了这么久都快要撕破头发了,希望有人能从我的奋斗中吸取教训!