Skip to content

Commit 8972b56

Browse files
committed
feat!: make Init return the model
1 parent a93bfef commit 8972b56

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

filepicker/filepicker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ func (m Model) readDir(path string, showHidden bool) tea.Cmd {
236236
}
237237

238238
// Init initializes the file picker model.
239-
func (m Model) Init() tea.Cmd {
240-
return m.readDir(m.CurrentDirectory, m.ShowHidden)
239+
func (m Model) Init() (Model, tea.Cmd) {
240+
return m, m.readDir(m.CurrentDirectory, m.ShowHidden)
241241
}
242242

243243
// Update handles user interactions within the file picker model.

stopwatch/stopwatch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ func (m Model) ID() int {
7373
}
7474

7575
// Init starts the stopwatch.
76-
func (m Model) Init() tea.Cmd {
77-
return m.Start()
76+
func (m Model) Init() (Model, tea.Cmd) {
77+
return m, m.Start()
7878
}
7979

8080
// Start starts the stopwatch.

timer/timer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ func (m Model) Timedout() bool {
125125
}
126126

127127
// Init starts the timer.
128-
func (m Model) Init() tea.Cmd {
129-
return m.tick()
128+
func (m Model) Init() (Model, tea.Cmd) {
129+
return m, m.tick()
130130
}
131131

132132
// Update handles the timer tick.

viewport/viewport.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ func (m *Model) setInitialValues() {
6464
}
6565

6666
// Init exists to satisfy the tea.Model interface for composability purposes.
67-
func (m Model) Init() tea.Cmd {
68-
return nil
67+
func (m Model) Init() (Model, tea.Cmd) {
68+
return m, nil
6969
}
7070

7171
// AtTop returns whether or not the viewport is at the very top position.

0 commit comments

Comments
 (0)