How to use the mobx-utils/lib/create-view-model.createViewModel function in mobx-utils

To help you get started, we’ve selected a few mobx-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apsavin / pgrights / src / components / DbTableRlsForm / DbTableRlsForm.js View on Github external
getCurrentTableViewModel() {
    const { dbConnectionsManager } = this.props;
    const currentTable = dbConnectionsManager.getCurrentTable();

    if (!currentTable) {
      return null;
    }

    if (!this.currentTableViewModel) {
      this.currentTableViewModel = createViewModel(currentTable);
    }

    if (this.currentTableViewModel.model !== currentTable) {
      this.currentTableViewModel.model = currentTable;
    }

    return this.currentTableViewModel;
  }