View not being triggered after Update #851
Unanswered
jeffdupont
asked this question in
Q&A
Replies: 2 comments
-
Hey @jeffdupont sorry we haven't replied sooner. Do you have any example code where we can reproduce this behaviour? |
Beta Was this translation helpful? Give feedback.
0 replies
-
No worries. I don’t remember exactly what the issue was, so I can’t provide any example code. Sorry. But for the prior comment on if I got it to work, well the answer is… yes? I at least got it somewhat working… hear me out. So my initial idea was that I would be able to populate a list of topics when the app first loads. Selecting the topic would then fill in the columns with data and subscribe to the socket data for that topic and begin listening and updating the display in real time. I believe that was where the issue stemmed was that after selecting the topic and loading the board, it would hang. What my app currently does is that it now takes in the topic directly from the command line argument and loads from there. I’ll try and detail out what the model and logic currently does to maybe answer… First, the `Board` model has the reference to the socket connection and the channel for messages. When the app loads the board for the first time, it creates a goroutine to listen on the socket `go b.socketListener()`. The listener is loops as long as the socket is connected and the app is not shutting down. When a message is `Received` and is not EOF it will pass the message onto the channel on the board. Once the board fires the `Init()` call, part of the `tea.Batch` is to establish a `waitForActivity(chan) tea.Cmd` that reads in the channel message and determines what to do with the payload. Each message type will return an empty struct that is unique to the message so that the board Update knows how to handle the new info. On each branch within the `Update` that deals with a socket message, the return will call the `waitForActivity()` again and the process starts again. This seems to properly render all the column data on the board, and each item properly moves through the columns as the data is updated over the socket. Wish I could just share the project code for reference, but it was for a client and contains some business details he probably doesn’t want shared. If I get more time, I may try and pull out just the socket details to create a cleaner example for reference. So hope that helps :)
- Jeff
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a socket connection that receives information that I load into columns lists. I'm following the kancli basics for my layout. Now the columns load fine, but the main board never leaves the "loading..." state. I've tried numerous ways to get the board to update and redraw the lists now that the
loaded
flag is set to true. The log never shows the line from within theView
until I hit a key, and then everything shows up.The socket listener is spun out in a goroutine within the
NewBoard
method call when starting the program up. The socket listener is also a method on the pointer to theBoard
struct. Calling theUpdate(nil)
on the board pointer logs the action case on the switch statement but never logs theView
log point.Sorry if this seems a bit jumbled... I've been trying to figure this out for hours now.
Beta Was this translation helpful? Give feedback.
All reactions