• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mizchi / next-editor / 1448

28 Feb 2024 12:17PM UTC coverage: 42.344% (+0.6%) from 41.712%
1448

Pull #349

circleci

web-flow
chore(deps): update babel monorepo
Pull Request #349: chore(deps): update babel monorepo

95 of 450 branches covered (21.11%)

Branch coverage included in aggregate %.

967 of 2058 relevant lines covered (46.99%)

1.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/ui/components/utils/Initializer.tsx
1
import delay from "delay"
×
2
import React from "react"
×
3
import lifecycle from "recompose/lifecycle"
×
4
import { connector } from "../../actionCreators"
×
5
import * as EditorActions from "../../actionCreators/editorActions"
6
import * as ConfigActions from "../../reducers/config"
7

8
type ConnectedProps = {
9
  isFirstVisit: boolean
10
  setConfigValue: typeof ConfigActions.setConfigValue
11
  loadFile: typeof EditorActions.loadFile
12
  initializeGitStatus: typeof EditorActions.initializeGitStatus
13
}
14

15
export const Initializer = connector(
×
16
  state => {
17
    return {
×
18
      isFirstVisit: state.config.isFirstVisit
19
    }
20
  },
21
  actions => {
22
    return {
×
23
      setConfigValue: actions.config.setConfigValue,
24
      loadFile: actions.editor.loadFile,
25
      initializeGitStatus: actions.editor.initializeGitStatus
26
    }
27
  },
28
  lifecycle<ConnectedProps, {}>({
29
    async componentDidMount() {
30
      // UI Boot
31
      await delay(150)
×
32
      const { isFirstVisit, ...actions } = this.props
×
33

34
      if (isFirstVisit) {
35
        // Start omotenashi
36
        // Remove first visit flag
37
        await actions.setConfigValue({ key: "isFirstVisit", value: false })
×
38

39
        // Open scratch.md as user first view
40
        actions.loadFile({ filepath: "/playground/scratch.md" })
×
41

42
        // TODO: Reload git on init. Sometimes initialze on git is failing
43
        await delay(300)
×
44
        actions.initializeGitStatus("/playground")
×
45
      }
46

47
      // TODO: dirty hack to focus
48
      // Focus first element
49
      await delay(150)
×
50
      const target = (document as any).querySelector("textarea")
×
51
      target && target.focus()
×
52
    }
53
  })
54
)(function InitializerImpl({ children }) {
55
  // NOTE: Enter recovery mode if you need
56
  // throw new Error("test error message")
57
  return <>{children}</>
×
58
})
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc