we compiled but buffer doesnt work

This commit is contained in:
filipriec
2025-08-29 18:11:27 +02:00
parent 58f109ca91
commit 16dd460469
13 changed files with 256 additions and 166 deletions

View File

@@ -15,9 +15,10 @@ pub enum SaveOutcome {
pub async fn save(
app_state: &mut AppState,
path: &str,
grpc_client: &mut GrpcClient,
) -> Result<SaveOutcome> {
if let Some(fs) = app_state.active_form_state_mut(buffer_state) {
if let Some(fs) = app_state.form_state_for_path(path) {
if !fs.has_unsaved_changes {
return Ok(SaveOutcome::NoChange);
}
@@ -62,7 +63,7 @@ pub async fn save(
.context("Failed to post new table data")?;
if response.success {
if let Some(fs) = app_state.active_form_state_mut(buffer_state) {
if let Some(fs) = app_state.form_state_for_path(path) {
fs.id = response.inserted_id;
fs.total_count += 1;
fs.current_position = fs.total_count;
@@ -84,7 +85,7 @@ pub async fn save(
.context("Failed to put (update) table data")?;
if response.success {
if let Some(fs) = app_state.active_form_state_mut(buffer_state) {
if let Some(fs) = app_state.form_state_for_path(path) {
fs.has_unsaved_changes = false;
}
SaveOutcome::UpdatedExisting
@@ -101,9 +102,10 @@ pub async fn save(
pub async fn revert(
app_state: &mut AppState,
path: &str,
grpc_client: &mut GrpcClient,
) -> Result<String> {
if let Some(fs) = app_state.active_form_state_mut(buffer_state) {
if let Some(fs) = app_state.form_state_for_path(path) {
if fs.id == 0
|| (fs.total_count > 0 && fs.current_position > fs.total_count)
|| (fs.total_count == 0 && fs.current_position == 1)