Skip to content

Commit

Permalink
Backmerge: #1936 Adding functional group to atom generate a JavaScrip…
Browse files Browse the repository at this point in the history
…t console error (#1949)

Co-authored-by: ansivgit <[email protected]>
  • Loading branch information
KonstantinEpam23 and ansivgit authored Dec 16, 2022
1 parent bc8bd5e commit 0174be4
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ interface TemplateLibProps {
filter: string
group: string
lib: Array<Template>
selected: Template
selected: Template | null
mode: string
initialTab: number
saltsAndSolvents: Template[]
Expand Down Expand Up @@ -330,6 +330,14 @@ const TemplateDialog: FC<Props> = (props) => {
)
}

const selectTemplate = (template, props, dispatch) => {
dispatch(selectTmpl(null))
if (!template) return
dispatch(selectTmpl(template))
dispatch(onAction({ tool: 'template', opts: template }))
props.onOk(template)
}

export default connect(
(store) => ({
...omit(['attach'], (store as any).templates),
Expand All @@ -339,11 +347,7 @@ export default connect(
}),
(dispatch: Dispatch<any>, props: Props) => ({
onFilter: (filter) => dispatch(changeFilter(filter)),
onSelect: (tmpl) => {
dispatch(selectTmpl(tmpl))
dispatch(onAction({ tool: 'template', opts: tmpl }))
props.onOk(tmpl)
},
onSelect: (tmpl) => selectTemplate(tmpl, props, dispatch),
onChangeGroup: (group) => dispatch(changeGroup(group)),
onAttach: (tmpl) => dispatch(editTmpl(tmpl)),
onDelete: (tmpl) => dispatch(deleteTmpl(tmpl))
Expand Down

0 comments on commit 0174be4

Please sign in to comment.