web: refresh tags on thread view in addition to search results.
This commit is contained in:
parent
0ae72b63d0
commit
d5a001bf03
@ -18,4 +18,9 @@ query ShowThreadQuery($threadId: String!) {
|
||||
timestamp
|
||||
}
|
||||
}
|
||||
tags {
|
||||
name
|
||||
bgColor
|
||||
fgColor
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +173,13 @@ struct Model {
|
||||
context: Context,
|
||||
refreshing_state: RefreshingState,
|
||||
ui_error: UIError,
|
||||
tags: Option<Vec<crate::graphql::front_page_query::FrontPageQueryTags>>,
|
||||
tags: Option<Vec<Tag>>,
|
||||
}
|
||||
|
||||
struct Tag {
|
||||
name: String,
|
||||
bg_color: String,
|
||||
fg_color: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
@ -381,7 +387,16 @@ fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
Msg::FrontPageResult(Ok(graphql_client::Response {
|
||||
data: Some(data), ..
|
||||
})) => {
|
||||
model.tags = Some(data.tags);
|
||||
model.tags = Some(
|
||||
data.tags
|
||||
.into_iter()
|
||||
.map(|t| Tag {
|
||||
name: t.name,
|
||||
bg_color: t.bg_color,
|
||||
fg_color: t.fg_color,
|
||||
})
|
||||
.collect(),
|
||||
);
|
||||
model.context = Context::SearchResult {
|
||||
query: model.query.clone(),
|
||||
results: data.search.nodes,
|
||||
@ -403,6 +418,16 @@ fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
Msg::ShowThreadResult(Ok(graphql_client::Response {
|
||||
data: Some(data), ..
|
||||
})) => {
|
||||
model.tags = Some(
|
||||
data.tags
|
||||
.into_iter()
|
||||
.map(|t| Tag {
|
||||
name: t.name,
|
||||
bg_color: t.bg_color,
|
||||
fg_color: t.fg_color,
|
||||
})
|
||||
.collect(),
|
||||
);
|
||||
model.context = Context::ThreadResult(data.thread);
|
||||
}
|
||||
Msg::ShowThreadResult(bad) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user