Skip to content

VMO-7115 wip#351

Draft
bulatgab wants to merge 1 commit intofeature/VMO-6851/VMO-7040/add-block-code-editorfrom
feature/VMO-6150/VMO-7115/refactor-watchers
Draft

VMO-7115 wip#351
bulatgab wants to merge 1 commit intofeature/VMO-6851/VMO-7040/add-block-code-editorfrom
feature/VMO-6150/VMO-7115/refactor-watchers

Conversation

@bulatgab
Copy link
Collaborator

@bulatgab bulatgab commented Sep 27, 2022

Todo:

  • fix this on this lines
supportedModes: this.activeFlow.supported_modes,
supportedLanguages: this.activeFlow.languages,
  • test

Comment:
I've tried doing it more elegantly (?) like this, but I wasn't able to access store.dispatch this way:

// in `InteractionDesigner.created()`
watchers.forEach(({getter, callback, options}) => this.$store.watch(getter, callback, options))

// in `store/validation/index.ts`
export const watchers: StoreWatcherParams<IRootState, unknown>[] = [
  {
    getter: (_, rootGetters) => rootGetters['activeFlow'],
    callback: activeFlow => this.debounceFlowValidation({newFlow}),
    options: {deep: true, immediate: true}
  },
]

type StoreWatcherParams<S, T> = {
  getter: (state: S, getters: any) => T,
  callback: (value: T, oldValue: T) => void,
  options?: WatchOptions,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant