Problems rendering Task after code refactoring. #275
-
I looked through the codebase for the CLI Kanban tutorial and decided to refactor the source files by moving them to separate directories (typedef.go goes to /typedef, task.go goes to /task, etc). I moved task.go to the task package.
In model.go, // model.go
func (m *Model) initLists(width, height int) {
// original task creation code
for _, value := range columns.Todo {
task := Task{status: typedef.Todo, title: value.Title, description: value.Description}
todoItems = append(todoItems, task)
}
// task creation post refactoring
for _, value := range columns.Todo {
task := task.NewTask(typedef.Todo, value.Title, value.Description)
todoItems = append(todoItems, task)
}
} // task/task.go
func NewTask(status typedef.Status, title string, description string) Task {
return Task{status: status, title: title, description: description}
} After the changes, the Tasks within the columns could not be rendered properly. How does BubbleTea render the |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hey @zerovirus123 do you mind pushing the latest changes to your |
Beta Was this translation helpful? Give feedback.
-
Hi @bashbunni, I just pushed the latest version to my repo. Sorry for the delay. |
Beta Was this translation helpful? Give feedback.
-
Ah so the issue is just that you renamed the Line 64 in cd2593c I've also attached the git diff of my changes to get it running. (Might also include some minor formatting changes from my Go formatter) |
Beta Was this translation helpful? Give feedback.
-
Hi, could you please submit a PR? That would be more readable. Thanks.
Brian
…On Wed, Oct 19, 2022 at 12:03 PM bashbunni ***@***.***> wrote:
Let me know if it's more readable for me to PR the changes - totally up to
you. I've got the working version on my machine 😄
—
Reply to this email directly, view it on GitHub
<#275 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACHXFN7DWBFUTMH4VW6JDM3WD56LFANCNFSM6AAAAAARHIRNUA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
Ah so the issue is just that you renamed the
Title
andDescription
methods which actually need to keep their method signature to implement theDefaultItem
interface. Check out this portion to see what I'm talking about:bubbles/list/defaultitem.go
Line 64 in cd2593c
I've also attached the git diff of my changes to get it running. (Might also include some minor formatting changes from my Go formatter)
diff.txt