Skip to content

Commit

Permalink
proper reactive
Browse files Browse the repository at this point in the history
  • Loading branch information
XiangpengHao committed Dec 15, 2024
1 parent cd4e2af commit 6baa015
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ fn App() -> impl IntoView {
if let Some(info) = info {
match user_input.get() {
Some(user_input) => {
set_user_input.set(Some(user_input.clone()));
set_user_input.set(Some(user_input));
}
None => {
logging::log!("{}", info.to_string());
Expand All @@ -348,16 +348,19 @@ fn App() -> impl IntoView {
);

Effect::watch(
user_input,
move |user_input, _, _| {
move || (user_input.get(), parquet_info.get()),
move |(user_input, parquet), _, _| {
let Some(user_input_str) = user_input else {
return;
};
if parquet.is_none() {
return;
}
set_user_input.set(Some(user_input_str.clone()));
let user_input = user_input_str.clone();
let api_key = api_key.clone();
leptos::task::spawn_local(async move {
let Some(parquet_info) = parquet_info() else {
let Some(parquet_info) = parquet_info.get() else {
return;
};
let sql = match query_input::user_input_to_sql(
Expand Down

0 comments on commit 6baa015

Please sign in to comment.