How to use the @rematch/core.dispatch.project function in @rematch/core

To help you get started, we’ve selected a few @rematch/core 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 eveningkid / reacto / src / store / models / project.js View on Github external
switchProject(cwd, rootState) {
      // If current .cwd
      const currentCwd = rootState.project.cwd;
      if (currentCwd) {
        // Reset both session and project
        dispatch.session.resetSession();
        dispatch.project.resetProject();
      }

      // Change local .cwd
      this.updateCwd(cwd);

      // Add or update history's recent project
      dispatch.history.addOrUpdateRecentProject(cwd);
    },
  },
github eveningkid / reacto / src / tools / package-managers / _base / package-manager.js View on Github external
update = () => {
    dispatch.project.updatePackageManager({ packageManager: this });

    ParentProcessManager.send(
      ParentProcessManager.actions.UPDATE_PACKAGE_MANAGER,
      this
    );

    this.listeners.forEach(callback => callback(this));
  };
github eveningkid / reacto / src / editor / managers / todo-manager.js View on Github external
Promise.all(workers).then(todos => {
      todos = todos.filter(currentTodos => currentTodos.length > 0);
      dispatch.project.replaceTodos(todos);
    });
  }
github eveningkid / reacto / src / store / models / session.js View on Github external
fs.readFile(pathToFile, 'utf-8', (err, code) => {
          if (err) return;
          this.openFile({ pathToFile, code });
          if (temporaryFile) dispatch.project.closeFile(temporaryFile);
          dispatch.project.openTemporaryFile(pathToFile);
        });
      }
github eveningkid / reacto / src / editor / managers / git-manager.js View on Github external
static _dispatchNewStatus(filesStatus) {
    const currentFileStatus = getState().project.git.filesStatus;
    for (const [path, status] of Object.entries(filesStatus)) {
      if (currentFileStatus[path] && currentFileStatus[path] === status) {
        delete filesStatus[path];
      }
    }
    if (Object.keys(filesStatus).length > 0) {
      dispatch.project.updateGitFilesStatus(filesStatus);
    }
  }
github eveningkid / reacto / src / editor / events / switch-package-manager.js View on Github external
default:
    case SwitchPackageManager.NPM:
      if (typeof currentPackageManager !== packageManagers.NpmPackageManager) {
        packageManager = new packageManagers.NpmPackageManager();
      }
      break;

    case SwitchPackageManager.YARN:
      if (typeof currentPackageManager !== packageManagers.YarnPackageManager) {
        packageManager = new packageManagers.YarnPackageManager();
      }
      break;
  }

  if (packageManager) {
    dispatch.project.updatePackageManager({ packageManager });
  }
}
github eveningkid / reacto / src / store / models / session.js View on Github external
fs.rename(filePath, newFilePath, err => {
        if (err) return;
        dispatch.project.renameOpenedFile({ filePath, newFilePath });
        this.renameFile({ filePath, newFilePath });
      });
    },
github eveningkid / reacto / src / store / models / session.js View on Github external
fileToFallbackTo = openedFiles[i - 1];
              } else if (openedFiles[i + 1]) {
                fileToFallbackTo = openedFiles[i + 1];
              }
            }
          }

          dispatch.project.closeFile(pathToFile);

          if (fileToFallbackTo) {
            this.openFile({ pathToFile: fileToFallbackTo.filePath });
          } else {
            this.cleanCurrentSession();
          }
        } else {
          dispatch.project.closeFile(pathToFile);
        }
      };
github eveningkid / reacto / src / tools / task-runners / npm / npm.js View on Github external
update = () => {
    dispatch.project.updateTaskRunner({ taskRunner: this });
  };