Get started
Introduction
Installation
Your first app
Tutorials
Fission tutorials
Build an offline-first notes app for Android and iOS
Core concepts
Components
State and effects
Protected routes
Server-side rendering
Styling
Testing
Deployment
Reference
API reference
Cookbook
Fission 0.16.0
Documentation version
Read the changelog →

Build an offline-first notes app for Android and iOS

Create and edit field notes through real SQLite effects, keep an uncertain write visible, and guard the revision boundary for a future sync service.
Android

What you will build

Save field notes locally without presenting an in-memory edit or an old sync response as current saved data
Give stored notes SQLite-assigned IDs and checked revisions
Create, search and edit notes before a network service is available
Confirm local writes and block blind retries after an uncertain result
Leave notes waiting for sync until a real service confirms their revision

Create a shared field-notes project

Install Fission, create the project, and add both native targets. Shared screens and note behavior live in Rust so the Android and iOS builds use the same workflow.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"Create the project","value":"create-the-project"},{"index":1,"label":"Where the code lives","value":"where-the-code-lives"}]}
{"id":"fission-tabs-1","index":0,"label":"Create the project","value":"create-the-project"}
cargo install cargo-fission
fission init field-notes
cd field-notes
fission add-target android ios --project-dir .
fission add-capability storage --project-dir .
cargo add serde_yaml
{"id":"fission-tabs-1","index":1,"label":"Where the code lives","value":"where-the-code-lives"}
field-notes/
├── Cargo.toml
├── fission.toml
├── src/
│   ├── main.rs
│   ├── lib.rs
│   └── app.rs
└── platforms/
    ├── android/
    └── ios/
{"id":"fission-tabs-1"}
fission add-capability storage enables Fission’s SQLite provider on native targets. Keep the model and screens in src/; the generated platform folders launch and package the same app. That way Android and iOS don’t grow separate save and edit behaviour.
This tutorial implements local persistence and the reducer boundary for a sync result. It does not make an HTTP request or include a server endpoint. Until you connect a real service, new notes stay Waiting to sync; the preview’s sample Synced records are only there to show how the list looks.

Run the finished example

fission run --target android --project-dir .

1. Shape a note around a real field visit

Between sites, a technician needs to know which job a note belongs to, what they saw, when they recorded it, and whether it still needs to sync. A title and paragraph stop being enough once the notebook has more than a few entries.
We’ll build Harbour Field Notes for a maintenance crew. Each record has a stable ID, worksite, title, observation, update time, local revision, and sync status. The sample notes cover a gate inspection, rooftop inverter, and loading-dock drain. That gives the list and detail view something useful to show before we add editing.
Start with the record type and a screen that helps the technician find a note. FieldNoteListItem and FieldNotesWorkspace are named fission_component! components, so the screen has reusable boundaries instead of one anonymous tree.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"src/models.rs","value":"src-models-rs"},{"index":1,"label":"src/state.rs","value":"src-state-rs"},{"index":2,"label":"src/translations.rs","value":"src-translations-rs"},{"index":3,"label":"src/app.rs","value":"src-app-rs"},{"index":4,"label":"src/widgets/mod.rs","value":"src-widgets-mod-rs"},{"index":5,"label":"src/widgets/field_note_list_item.rs","value":"src-widgets-field-note-list-item-rs"},{"index":6,"label":"src/lib.rs","value":"src-lib-rs"},{"index":7,"label":"preview/lib.rs","value":"preview-lib-rs"},{"index":8,"label":"preview/fixtures.rs","value":"preview-fixtures-rs"}]}
{"id":"fission-tabs-1","index":0,"label":"src/models.rs","value":"src-models-rs"}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum NoteSyncStatus {
    Synced,
    WaitingToSync,
}

impl NoteSyncStatus {
    pub fn translation_key(&self) -> &'static str {
        match self {
            Self::Synced => "notes.sync.synced",
            Self::WaitingToSync => "notes.sync.waiting",
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct FieldNote {
    pub id: i64,
    pub site: String,
    pub title: String,
    pub observation: String,
    pub updated_at: String,
    pub revision: u32,
    pub sync_status: NoteSyncStatus,
}
{"id":"fission-tabs-1","index":1,"label":"src/state.rs","value":"src-state-rs"}
use fission::prelude::*;
use crate::models::*;
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct FieldNotesState {
    pub notes: Vec<FieldNote>,
}

impl GlobalState for FieldNotesState {}
{"id":"fission-tabs-1","index":2,"label":"src/translations.rs","value":"src-translations-rs"}
use fission::i18n::{Locale, TranslationBundle};
use fission::prelude::*;
use std::collections::HashMap;

pub fn create_env() -> Env {
    let mut env = Env::default();
    env.locale = Locale::from("en-US");
    for (locale, yaml) in [
        ("en-US", include_str!("../i18n/en-US.yaml")),
        ("es-ES", include_str!("../i18n/es-ES.yaml")),
    ] {
        let messages: HashMap<String, String> =
            serde_yaml::from_str(yaml).expect("valid Harbour Field Notes translations");
        env.i18n.add_bundle(TranslationBundle {
            locale: Locale::from(locale),
            messages,
        });
    }
    env
}
{"id":"fission-tabs-1","index":3,"label":"src/app.rs","value":"src-app-rs"}
use fission::prelude::*;
use crate::{models::*, state::*};
use crate::widgets::*;
fission_component! {
    pub FieldNotesWorkspace<FieldNotesState> {}
    view(_workspace, state, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let notes = &state.notes;
        let selected = notes.first();
        let selected_id = selected.map(|note| note.id);
        let waiting_count = notes.iter()
            .filter(|note| note.sync_status == NoteSyncStatus::WaitingToSync)
            .count();
    } =>
    SemanticsRegion(
        identifier: Some("harbour-field-notes".to_string()),
        label: Some(cx.tr("notes.app.title")),
        child: Scroll(
            flex_grow: 1.0,
            height: cx.view.viewport_size().height,
            semantic_label: Some(cx.tr("notes.workspace.a11y")),
            child: Container(
                Column(gap: tokens.spacing.l, children: [
                    Row(gap: tokens.spacing.m, wrap: ir_op::FlexWrap::Wrap, children: [
                        Column(gap: tokens.spacing.xs, children: [
                            Text(cx.tr("notes.app.title"))
                                .weight(tokens.typography.font_weight_bold),
                            Text(cx.tr("notes.app.subtitle"))
                                .color(tokens.colors.text_secondary),
                        ]),
                        Spacer(flex_grow: 1.0),
                        Text(cx.tr("notes.device.available")),
                    ]),
                    Grid(
                        columns: vec![GridTrack::auto_fit(GridTrack::minmax(
                            GridTrack::Points(150.0),
                            GridTrack::Fr(1.0),
                        ))],
                        rows: vec![GridTrack::Auto],
                        column_gap: tokens.spacing.m,
                        row_gap: tokens.spacing.s,
                        children: [
                            Column(children: [
                                Text(cx.tr("notes.summary.notes").replace("{count}", &notes.len().to_string()))
                                    .weight(tokens.typography.font_weight_semibold),
                                Text(cx.tr("notes.summary.device"))
                                    .color(tokens.colors.text_secondary),
                            ]),
                            Column(children: [
                                Text(cx.tr("notes.summary.waiting").replace("{count}", &waiting_count.to_string()))
                                    .weight(tokens.typography.font_weight_semibold),
                                Text(cx.tr("notes.summary.sync"))
                                    .color(tokens.colors.text_secondary),
                            ]),
                        ],
                    ),
                    Divider(),
                            Column(gap: tokens.spacing.s, children: [
                                Text(cx.tr("notes.list.title"))
                                    .weight(tokens.typography.font_weight_semibold),
                                Text(cx.tr("notes.list.hint"))
                                    .color(tokens.colors.text_secondary),
                                if notes.is_empty() {
                                    EmptyState(
                                        title: cx.tr("notes.empty.first_title"),
                                        description: Some(cx.tr("notes.empty.first_note")),
                                    )
                                } else {
                                    Column(gap: tokens.spacing.s, children: [
                                        for note in notes.iter() {
                                            FieldNoteListItem(
                                                note.clone(),
                                                Some(note.id) == selected_id,
                                                key: note.id,
                                            ).id(WidgetId::explicit(&format!("field-note.{}", note.id)))
                                        },
                                    ])
                                },
                    ]),
                    if let Some(selected) = selected {
                        Container(
                            Column(gap: tokens.spacing.s, children: [
                                Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
                                    Text(selected.site.clone())
                                        .color(tokens.colors.text_secondary),
                                    Spacer(flex_grow: 1.0),
                                    Text(cx.tr(selected.sync_status.translation_key())),
                                ]),
                                Text(selected.title.clone())
                                    .weight(tokens.typography.font_weight_bold),
                                Text(selected.observation.clone()),
                                Text(cx.tr("notes.updated_revision")
                                    .replace("{time}", &if selected.updated_at.is_empty() { cx.tr("notes.time.not_committed") } else { selected.updated_at.clone() })
                                    .replace("{revision}", &selected.revision.to_string()))
                                    .color(tokens.colors.text_secondary),
                            ]),
                        )
                        .padding_all(tokens.spacing.l)
                        .bg(tokens.colors.surface)
                        .border(tokens.colors.border, 1.0)
                        .border_radius(tokens.radii.large)
                    } else {
                        Text(cx.tr("notes.detail.none"))
                            .color(tokens.colors.text_secondary)
                    },
                ]),
            )
            .padding_all(tokens.spacing.l)
            .bg(tokens.colors.background),
        ),
    )
}
{"id":"fission-tabs-1","index":4,"label":"src/widgets/mod.rs","value":"src-widgets-mod-rs"}
mod field_note_list_item;
pub use field_note_list_item::FieldNoteListItem;
{"id":"fission-tabs-1","index":5,"label":"src/widgets/field_note_list_item.rs","value":"src-widgets-field-note-list-item-rs"}
use fission::prelude::*;
use crate::{models::*, state::*};
fission_component! {
    pub FieldNoteListItem<()> {
        props {
        note: FieldNote,
        selected: bool,
        }
    }
    view(row, _state, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let status = if row.selected { "notes.row.selected" } else { row.note.sync_status.translation_key() };
    } =>
    Container(
        Column(gap: tokens.spacing.xs, children: [
            Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
                Text(row.note.title.clone())
                    .weight(tokens.typography.font_weight_semibold),
                Spacer(flex_grow: 1.0),
                Text(cx.tr(status)),
            ]),
            Text(row.note.site.clone()).color(tokens.colors.text_secondary),
            Text(row.note.updated_at.clone()).color(tokens.colors.text_secondary),
        ]),
    )
    .padding_all(tokens.spacing.m)
    .bg(tokens.colors.surface)
    .border(tokens.colors.border, 1.0)
    .border_radius(tokens.radii.medium)
}
{"id":"fission-tabs-1","index":6,"label":"src/lib.rs","value":"src-lib-rs"}
mod models;
mod state;
mod widgets;
mod app;
mod translations;
use fission::prelude::*;
#[cfg(not(any(target_arch = "wasm32", target_os = "android", target_os = "ios")))]
pub fn run_desktop() -> anyhow::Result<()> {
    DesktopApp::<state::FieldNotesState, _>::new(app::FieldNotesWorkspace::new())
        .with_env(translations::create_env()).with_title("Harbour Field Notes")
        .run()
}
#[cfg(any(target_os = "android", target_os = "ios"))]
fn mobile_app() -> MobileApp<state::FieldNotesState, app::FieldNotesWorkspace> {
    MobileApp::new(app::FieldNotesWorkspace::new())
        .with_env(translations::create_env()).with_title("Harbour Field Notes")

}
#[cfg(any(target_os = "android", target_os = "ios"))]
pub fn run_mobile() -> anyhow::Result<()> { mobile_app().run() }
#[cfg(target_os = "android")]
#[no_mangle]
fn android_main(app_handle: AndroidApp) { let _ = mobile_app().run_with_android_app(app_handle); }
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn run_web() -> Result<(), wasm_bindgen::JsValue> {
    WebApp::<state::FieldNotesState, _>::new(app::FieldNotesWorkspace::new())
        .with_env(translations::create_env()).with_title("Harbour Field Notes")
        .run()
        .map_err(|error| wasm_bindgen::JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":7,"label":"preview/lib.rs","value":"preview-lib-rs"}
mod app;
mod models;
mod state;
mod widgets;
mod translations;
#[path = "../preview/fixtures.rs"]
mod fixtures;

use state::FieldNotesState;
use fission::prelude::*;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(start)]
pub fn run() -> Result<(), JsValue> {
    console_error_panic_hook::set_once();
    WebApp::<FieldNotesState, _>::new(app::FieldNotesWorkspace::new())
        .with_state_init(|state| state.notes = fixtures::sample_notes())
        .with_env(translations::create_env())
        .with_title("Harbour Field Notes")
        .mount("#fission-web-mount")
        .run()
        .map_err(|error| JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":8,"label":"preview/fixtures.rs","value":"preview-fixtures-rs"}
use crate::models::{FieldNote, NoteSyncStatus};

pub fn sample_notes() -> Vec<FieldNote> {
    vec![
        FieldNote {
            id: 501,
            site: "North Yard · Gate 3".into(),
            title: "Latch catches after the gate closes".into(),
            observation: "The hinge is clear. Check the strike plate before ordering a replacement.".into(),
            updated_at: "Today · 09:18".into(),
            revision: 1,
            sync_status: NoteSyncStatus::Synced,
        },
        FieldNote {
            id: 502,
            site: "Rooftop Array · Inverter B".into(),
            title: "West fan vibration is increasing".into(),
            observation: "Vibration is strongest at the west fan mount. Recheck it during the afternoon round.".into(),
            updated_at: "Today · 08:52".into(),
            revision: 4,
            sync_status: NoteSyncStatus::WaitingToSync,
        },
        FieldNote {
            id: 503,
            site: "Loading Dock · Drain 4".into(),
            title: "Standing water cleared from the grate".into(),
            observation: "Leaves were cleared from the grate. Check the low corner after the next delivery.".into(),
            updated_at: "Yesterday · 16:36".into(),
            revision: 2,
            sync_status: NoteSyncStatus::Synced,
        },
    ]
}
{"id":"fission-tabs-1"}
The first screen shows the decisions a technician makes in the field: which site a note belongs to, what changed, and whether it still needs to sync. Next, we’ll add search and editing while keeping each local revision attached to its note.
notes.app.title: "Harbour Field Notes"
notes.app.subtitle: "Maintenance rounds · North and East sites"
notes.workspace.a11y: "Field notes workspace"
notes.device.available: "Available on this device"
notes.summary.notes: "{count} field notes"
notes.summary.device: "Current notebook records"
notes.summary.waiting: "{count} waiting to sync"
notes.summary.sync: "When a connection is available"
notes.list.title: "Recent field notes"
notes.list.hint: "Open a note to review the finding and its next action."
notes.row.selected: "Viewing"
notes.sync.synced: "Synced"
notes.sync.waiting: "Waiting to sync"
notes.sample.site.gate: "North Yard · Gate 3"
notes.sample.site.inverter: "Rooftop Array · Inverter B"
notes.sample.site.drain: "Loading Dock · Drain 4"
notes.sample.title.gate: "Latch catches after the gate closes"
notes.sample.title.inverter: "West fan vibration is increasing"
notes.sample.title.drain: "Standing water cleared from the grate"
notes.sample.observation.gate: "The latch catches on the second attempt as the gate swings in from the yard. The hinge is clear. Check the strike plate before ordering a replacement."
notes.sample.observation.inverter: "Vibration is strongest at the west fan mount. Cabinet temperature is normal; the unit remains online. Recheck the mount during the afternoon round."
notes.sample.observation.drain: "Leaves packed against the drain grate after last night’s rain. Water is flowing again; check the low corner after the next delivery."
notes.sample.time.today_918: "Today · 9:18 AM"
notes.sample.time.today_852: "Today · 8:52 AM"
notes.sample.time.yesterday_436: "Yesterday · 4:36 PM"
notes.time.just_now: "Just now"
notes.time.not_committed: "working copy, not stored"
notes.updated_revision: "Updated {time} · revision {revision}"
notes.action.open: "Open note"
notes.detail.title: "Field note: {title}"
notes.detail.none: "Select a note to see its finding and next action."
notes.detail.saved_waiting: "This note is saved here and will sync when a connection is available."
notes.detail.synced: "This note has synced."
notes.action.edit: "Edit note"
notes.editor.new: "New field note"
notes.editor.edit: "Edit field note"
notes.editor.help: "Add enough detail for the next person to act confidently."
notes.field.site: "Worksite or project"
notes.field.site.placeholder: "North Yard · Gate 3"
notes.field.title: "Note title"
notes.field.title.placeholder: "What should the next technician notice?"
notes.field.observation: "Observation"
notes.field.observation.placeholder: "Record what you checked, what you found, and what should happen next."
notes.notice.limit: "This example supports up to 500 notes. No partial list was accepted."
notes.action.reload_discard: "Reload saved notes and discard this draft"
notes.notice.ready: "Your field notes are available on this device."
notes.notice.new_prompt: "Add the site, a short title, and what you observed."
notes.notice.missing: "That note is no longer available."
notes.notice.editing: "Edits stay on this device until they can sync."
notes.notice.required: "Use a site of 1–80 characters, title of 1–160 and observation of 1–4,000."
notes.notice.fields_complete: "All required fields are present. Save again to store the note."
notes.notice.no_changes: "No changes to save."
notes.notice.not_available: "That note is no longer available. Keep the text and choose another note."
notes.notice.draft_discarded: "The draft was discarded; saved notes are unchanged."
notes.notice.saved_waiting: "Working copy updated in memory; not yet stored. {count} waiting to sync."
notes.notice.sqlite_empty: "SQLite returned no field-note result."
notes.notice.read_failed: "A saved field note could not be read."
notes.notice.storage_failed: "SQLite could not complete the field-notes operation."
notes.notice.saving: "Saving this note to SQLite…"
notes.notice.saved_not_visible: "The note was saved, but it is no longer in this view. Reload the list."
notes.notice.saved_on_device: "Saved on this device. This note is waiting to sync."
notes.notice.newer_revision: "A newer saved revision was found. Reload it before syncing."
notes.notice.opening: "Opening notes saved on this device."
notes.status.needs_attention: "Needs attention: {message}"
notes.status.saving: "Saving to this device…"
notes.action.save: "Save on this device"
notes.action.cancel: "Cancel draft"
notes.action.new: "New field note"
notes.action.loading: "Loading notes…"
notes.status.storage_unavailable: "Storage unavailable"
notes.status.notes_unavailable: "Notes unavailable"
notes.status.on_device: "On this device"
notes.status.reading_records: "Reading saved records"
notes.status.waiting_count: "{count} waiting"
notes.status.waiting_detail: "To sync when connected"
notes.status.finish_draft: "Finish or cancel this draft before searching or switching notes."
notes.field.search: "Search field notes"
notes.field.search.placeholder: "Search sites, titles, or observations"
notes.status.recent: "Recent field notes"
notes.status.shown_waiting: "{shown} shown · {waiting} waiting to sync"
notes.status.loading_open: "Opening notes saved on this device."
notes.error.open: "Saved field notes could not be opened."
notes.error.restore_access: "Restore access to device storage before creating a new note."
notes.empty.title: "No field notes yet."
notes.empty.help: "Start a note to record the worksite, what you found, and what should happen next."
notes.empty.search: "No field notes match that search."
notes.empty.search_help: "Try a site, equipment name, or phrase from the note."
notes.action.clear_search: "Clear search"
notes.status.wait_for_load: "Wait for the saved notes to load before opening a record."
notes.status.storage_unavailable_detail: "Your saved notes are unavailable until storage can be read."
notes.empty.open_title: "No note is open."
notes.empty.select_detail: "Choose a field note to see its details."
notes.empty.first_note: "Choose New field note to record the first site visit."
notes.empty.first_title: "No field notes on this device yet."
notes.empty.clear_search: "Clear the search to return to a field note."
notes.preview_only: "Preview changes live in memory. The Android and iOS app should commit each note to SQLite before showing it as saved."
notes.app.title: "Notas de campo Harbour"
notes.app.subtitle: "Rondas de mantenimiento · centros norte y este"
notes.workspace.a11y: "Espacio de notas de campo"
notes.device.available: "Disponible en este dispositivo"
notes.summary.notes: "{count} notas de campo"
notes.summary.device: "Registros del cuaderno actual"
notes.summary.waiting: "{count} pendientes de sincronizar"
notes.summary.sync: "Cuando haya conexión"
notes.list.title: "Notas de campo recientes"
notes.list.hint: "Abre una nota para revisar el hallazgo y la siguiente acción."
notes.row.selected: "En pantalla"
notes.sync.synced: "Sincronizada"
notes.sync.waiting: "Pendiente de sincronizar"
notes.sample.site.gate: "Patio norte · Puerta 3"
notes.sample.site.inverter: "Paneles de cubierta · Inversor B"
notes.sample.site.drain: "Muelle de carga · Desagüe 4"
notes.sample.title.gate: "El pestillo se atasca al cerrar la puerta"
notes.sample.title.inverter: "Aumenta la vibración del ventilador oeste"
notes.sample.title.drain: "Se retiró el agua estancada de la rejilla"
notes.sample.observation.gate: "El pestillo se atasca en el segundo intento cuando la puerta se cierra desde el patio. La bisagra está despejada. Revisa la placa antes de pedir un repuesto."
notes.sample.observation.inverter: "La vibración es más intensa en el soporte del ventilador oeste. La temperatura del armario es normal y la unidad sigue activa. Revisa el soporte en la ronda de la tarde."
notes.sample.observation.drain: "Las hojas obstruían la rejilla después de la lluvia de anoche. El agua vuelve a fluir; revisa la zona baja tras la próxima entrega."
notes.sample.time.today_918: "Hoy · 9:18"
notes.sample.time.today_852: "Hoy · 8:52"
notes.sample.time.yesterday_436: "Ayer · 16:36"
notes.time.just_now: "Ahora mismo"
notes.time.not_committed: "copia de trabajo, sin guardar"
notes.updated_revision: "Actualizada {time} · revisión {revision}"
notes.action.open: "Abrir nota"
notes.detail.title: "Nota de campo: {title}"
notes.detail.none: "Selecciona una nota para ver el hallazgo y la siguiente acción."
notes.detail.saved_waiting: "La nota está guardada aquí y se sincronizará cuando haya conexión."
notes.detail.synced: "La nota está sincronizada."
notes.action.edit: "Editar nota"
notes.editor.new: "Nueva nota de campo"
notes.editor.edit: "Editar nota de campo"
notes.editor.help: "Añade detalles suficientes para que otra persona pueda actuar con confianza."
notes.field.site: "Centro o proyecto"
notes.field.site.placeholder: "Patio norte · Puerta 3"
notes.field.title: "Título de la nota"
notes.field.title.placeholder: "¿Qué debería tener en cuenta el siguiente técnico?"
notes.field.observation: "Observación"
notes.field.observation.placeholder: "Anota qué revisaste, qué encontraste y cuál debería ser el siguiente paso."
notes.notice.limit: "Este ejemplo admite hasta 500 notas. No se ha aceptado una lista parcial."
notes.action.reload_discard: "Recargar las notas guardadas y descartar este borrador"
notes.notice.ready: "Tus notas de campo están disponibles en este dispositivo."
notes.notice.new_prompt: "Añade el centro, un título breve y lo que observaste."
notes.notice.missing: "La nota ya no está disponible."
notes.notice.editing: "Los cambios permanecen en este dispositivo hasta que puedan sincronizarse."
notes.notice.required: "Usa un centro de 1–80 caracteres, título de 1–160 y observación de 1–4000."
notes.notice.fields_complete: "Ya están todos los campos obligatorios. Guarda de nuevo para conservar la nota."
notes.notice.no_changes: "No hay cambios que guardar."
notes.notice.not_available: "La nota ya no está disponible. Conserva el texto y elige otra nota."
notes.notice.draft_discarded: "Se descartó el borrador; las notas guardadas no han cambiado."
notes.notice.saved_waiting: "Copia en memoria actualizada; aún no se guarda. {count} pendientes de sincronizar."
notes.notice.sqlite_empty: "SQLite no devolvió un resultado de notas."
notes.notice.read_failed: "No se pudo leer una nota guardada."
notes.notice.storage_failed: "SQLite no pudo completar la operación de notas."
notes.notice.saving: "Guardando esta nota en SQLite…"
notes.notice.saved_not_visible: "La nota se guardó, pero ya no aparece en esta vista. Vuelve a cargar la lista."
notes.notice.saved_on_device: "Guardada en este dispositivo. La nota está pendiente de sincronizar."
notes.notice.newer_revision: "Hay una revisión guardada más reciente. Vuelve a cargarla antes de sincronizar."
notes.notice.opening: "Abriendo las notas guardadas en este dispositivo."
notes.status.needs_attention: "Requiere atención: {message}"
notes.status.saving: "Guardando en este dispositivo…"
notes.action.save: "Guardar en este dispositivo"
notes.action.cancel: "Cancelar borrador"
notes.action.new: "Nueva nota de campo"
notes.action.loading: "Cargando notas…"
notes.status.storage_unavailable: "Almacenamiento no disponible"
notes.status.notes_unavailable: "Notas no disponibles"
notes.status.on_device: "En este dispositivo"
notes.status.reading_records: "Leyendo registros guardados"
notes.status.waiting_count: "{count} pendientes"
notes.status.waiting_detail: "Para sincronizar cuando haya conexión"
notes.status.finish_draft: "Termina o cancela este borrador antes de buscar o cambiar de nota."
notes.field.search: "Buscar notas de campo"
notes.field.search.placeholder: "Buscar centros, títulos u observaciones"
notes.status.recent: "Notas de campo recientes"
notes.status.shown_waiting: "{shown} visibles · {waiting} pendientes de sincronizar"
notes.status.loading_open: "Abriendo las notas guardadas en este dispositivo."
notes.error.open: "No se pudieron abrir las notas guardadas."
notes.error.restore_access: "Recupera el acceso al almacenamiento antes de crear una nota."
notes.empty.title: "Todavía no hay notas de campo."
notes.empty.help: "Crea una nota para registrar el centro, el hallazgo y el siguiente paso."
notes.empty.search: "Ninguna nota coincide con esa búsqueda."
notes.empty.search_help: "Prueba con un centro, un equipo o una frase de la nota."
notes.action.clear_search: "Borrar búsqueda"
notes.status.wait_for_load: "Espera a que se carguen las notas antes de abrir un registro."
notes.status.storage_unavailable_detail: "Tus notas no están disponibles hasta que se pueda leer el almacenamiento."
notes.empty.open_title: "No hay ninguna nota abierta."
notes.empty.select_detail: "Elige una nota de campo para ver sus detalles."
notes.empty.first_note: "Elige Nueva nota de campo para registrar la primera visita."
notes.empty.first_title: "Aún no hay notas de campo en este dispositivo."
notes.empty.clear_search: "Borra la búsqueda para volver a una nota."
notes.preview_only: "La vista previa mantiene los cambios en memoria. La app de Android y iOS debe confirmar cada nota en SQLite antes de mostrarla como guardada."
Show the app preview
Hide the app preview

2. Create, search, and edit notes without a connection

The list and detail panel both read FieldNotesState. Selecting a row changes the selected note ID; editing creates a new revision. Save on this device updates the local working copy and marks it waiting to sync. It does not claim a server accepted anything.
Search belongs to the workspace because it only changes which rows are visible. Notes, the selected ID, and edit draft belong in app state because several parts of the screen use them. The selected ID is an Option<i64>: None means no note is selected, so the app does not reserve a magic database ID such as zero. Starting a new note clears search so the new record stays visible after saving. A technician can write and save before the phone has a signal. A blank title, site, or observation keeps the draft open and explains what to fix.
The save reducer validates the draft, assigns a stable ID to a new note, increments the revision on edit, and keeps sync status truthful. Selecting another row is disabled while a draft is open, so an unfinished observation can’t disappear after an accidental tap.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"src/models.rs","value":"src-models-rs"},{"index":1,"label":"src/state.rs","value":"src-state-rs"},{"index":2,"label":"src/translations.rs","value":"src-translations-rs"},{"index":3,"label":"src/app.rs","value":"src-app-rs"},{"index":4,"label":"src/widgets/mod.rs","value":"src-widgets-mod-rs"},{"index":5,"label":"src/widgets/field_note_list_item.rs","value":"src-widgets-field-note-list-item-rs"},{"index":6,"label":"src/widgets/field_note_detail.rs","value":"src-widgets-field-note-detail-rs"},{"index":7,"label":"src/widgets/field_note_editor.rs","value":"src-widgets-field-note-editor-rs"},{"index":8,"label":"preview/lib.rs","value":"preview-lib-rs"}]}
{"id":"fission-tabs-1","index":0,"label":"src/models.rs","value":"src-models-rs"}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum NoteSyncStatus {
    Synced,
    WaitingToSync,
}

impl NoteSyncStatus {
    pub fn translation_key(&self) -> &'static str {
        match self {
            Self::Synced => "notes.sync.synced",
            Self::WaitingToSync => "notes.sync.waiting",
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct FieldNote {
    pub id: i64,
    pub site: String,
    pub title: String,
    pub observation: String,
    pub updated_at: String,
    pub revision: u32,
    pub sync_status: NoteSyncStatus,
}

pub fn matches_note(note: &FieldNote, query: &str) -> bool {
    query.is_empty()
        || note.site.to_lowercase().contains(query)
        || note.title.to_lowercase().contains(query)
        || note.observation.to_lowercase().contains(query)
}
{"id":"fission-tabs-1","index":1,"label":"src/state.rs","value":"src-state-rs"}
use fission::prelude::*;
use crate::models::*;
#[derive(Clone, Debug, PartialEq)]
pub struct FieldNotesState {
    pub notes: Vec<FieldNote>,
    pub selected_note_id: Option<i64>,
    pub next_note_id: i64,
    pub pending_note: Option<FieldNote>,
    pub site_draft: String,
    pub title_draft: String,
    pub observation_draft: String,
    pub is_editing: bool,
    pub is_new_note: bool,
    pub is_saving: bool,
    pub is_loading: bool,
    pub notice: String,
    pub has_error: bool,
    pub validation_error: bool,
}

impl Default for FieldNotesState {
    fn default() -> Self {
        Self {
            notes: Vec::new(),
            selected_note_id: None,
            next_note_id: 1,
            pending_note: None,
            site_draft: String::new(),
            title_draft: String::new(),
            observation_draft: String::new(),
            is_editing: false,
            is_new_note: false,
            is_saving: false,
            is_loading: false,
            notice: "notes.notice.ready".into(),
            has_error: false,
            validation_error: false,
        }
    }
}

impl GlobalState for FieldNotesState {}

#[fission_reducer(SelectFieldNote)]
pub fn on_select_field_note(state: &mut FieldNotesState, note_id: i64) {
    if state.is_editing || state.is_saving {
        return;
    }
    if state.notes.iter().any(|note| note.id == note_id) {
        state.selected_note_id = Some(note_id);
        state.notice.clear();
        state.has_error = false;
        state.validation_error = false;
    }
}

pub fn start_new_field_note(state: &mut FieldNotesState) {
    if state.is_editing || state.is_saving {
        return;
    }
    state.site_draft.clear();
    state.title_draft.clear();
    state.observation_draft.clear();
    state.pending_note = None;
    state.is_editing = true;
    state.is_new_note = true;
    state.notice = "notes.notice.new_prompt".into();
    state.has_error = false;
    state.validation_error = false;
}

#[fission_reducer(BeginNewFieldNote)]
pub fn on_begin_new_field_note(
    state: &mut FieldNotesState,
    _ctx: &mut ReducerContext<FieldNotesState>,
) {
    start_new_field_note(state);
}

#[fission_reducer(BeginEditFieldNote)]
pub fn on_begin_edit_field_note(state: &mut FieldNotesState, note_id: i64) {
    if state.is_editing || state.is_saving {
        return;
    }
    let Some(note) = state.notes.iter().find(|note| note.id == note_id).cloned() else {
        state.notice = "notes.notice.missing".into();
        state.has_error = true;
        state.validation_error = false;
        return;
    };
    state.selected_note_id = Some(note_id);
    state.site_draft = note.site;
    state.title_draft = note.title;
    state.observation_draft = note.observation;
    state.is_editing = true;
    state.is_new_note = false;
    state.notice = "notes.notice.editing".into();
    state.has_error = false;
    state.validation_error = false;
}

#[fission_reducer(SaveFieldNote)]
pub fn on_save_field_note(state: &mut FieldNotesState) {
    if state.is_saving {
        return;
    }
    let site = state.site_draft.trim().to_string();
    let title = state.title_draft.trim().to_string();
    let observation = state.observation_draft.trim().to_string();
    if site.is_empty() || title.is_empty() || observation.is_empty() {
        state.notice = "notes.notice.required".into();
        state.has_error = true;
        state.validation_error = true;
        return;
    }

    let saved_id = if state.is_new_note {
        let id = state.next_note_id;
        state.next_note_id = state.next_note_id.saturating_add(1);
        state.notes.push(FieldNote {
            id,
            site,
            title,
            observation,
            updated_at: String::new(),
            revision: 1,
            sync_status: NoteSyncStatus::WaitingToSync,
        });
        id
    } else {
        let Some(note) = state.notes.iter_mut()
            .find(|note| Some(note.id) == state.selected_note_id)
        else {
            state.notice = "notes.notice.not_available".into();
            state.has_error = true;
            state.validation_error = false;
            return;
        };
        if note.site == site && note.title == title && note.observation == observation {
            state.site_draft.clear();
            state.title_draft.clear();
            state.observation_draft.clear();
            state.is_editing = false;
            state.is_new_note = false;
            state.notice = "notes.notice.no_changes".into();
            state.has_error = false;
            state.validation_error = false;
            return;
        }
        note.site = site;
        note.title = title;
        note.observation = observation;
        note.updated_at = "notes.time.just_now".into();
        note.revision = note.revision.saturating_add(1);
        note.sync_status = NoteSyncStatus::WaitingToSync;
        note.id
    };

    state.selected_note_id = Some(saved_id);
    state.site_draft.clear();
    state.title_draft.clear();
    state.observation_draft.clear();
    state.is_editing = false;
    state.is_new_note = false;
    state.has_error = false;
    state.validation_error = false;
    let waiting = state.notes.iter()
        .filter(|note| note.sync_status == NoteSyncStatus::WaitingToSync)
        .count();
    state.notice = format!("notes.notice.saved_waiting|{waiting}");
}

#[fission_reducer(CancelFieldNoteDraft)]
pub fn on_cancel_field_note_draft(state: &mut FieldNotesState) {
    if state.is_saving {
        return;
    }
    state.site_draft.clear();
    state.title_draft.clear();
    state.observation_draft.clear();
    state.pending_note = None;
    state.is_editing = false;
    state.is_new_note = false;
    state.notice = "notes.notice.draft_discarded".into();
    state.has_error = false;
    state.validation_error = false;
}
{"id":"fission-tabs-1","index":2,"label":"src/translations.rs","value":"src-translations-rs"}
use fission::i18n::{Locale, TranslationBundle};
use fission::prelude::*;
use std::collections::HashMap;

pub fn create_env() -> Env {
    let mut env = Env::default();
    env.locale = Locale::from("en-US");
    for (locale, yaml) in [
        ("en-US", include_str!("../i18n/en-US.yaml")),
        ("es-ES", include_str!("../i18n/es-ES.yaml")),
    ] {
        let messages: HashMap<String, String> =
            serde_yaml::from_str(yaml).expect("valid Harbour Field Notes translations");
        env.i18n.add_bundle(TranslationBundle {
            locale: Locale::from(locale),
            messages,
        });
    }
    env
}
{"id":"fission-tabs-1","index":3,"label":"src/app.rs","value":"src-app-rs"}
use fission::prelude::*;
use crate::{models::*, state::*};
use crate::widgets::*;
fission_component! {
    pub FieldNotesWorkspace<FieldNotesState> {
        state {
            search: String = String::new(),
        }
    }
    view(workspace, app, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let query = workspace.search.trim().to_lowercase();
        let visible_notes: Vec<FieldNote> = app.notes.iter()
            .filter(|note| matches_note(note, &query))
            .cloned()
            .collect();
        let selected_note = visible_notes.iter()
            .find(|note| Some(note.id) == app.selected_note_id)
            .or_else(|| visible_notes.first())
            .cloned();
        let pending_count = app.notes.iter()
            .filter(|note| note.sync_status == NoteSyncStatus::WaitingToSync)
            .count();
        let notice_message = if let Some((key, count)) = app.notice.split_once('|') {
            cx.tr(key).replace("{count}", count)
        } else {
            cx.tr(&app.notice)
        };
        let notice = if app.has_error {
            cx.tr("notes.status.needs_attention").replace("{message}", &notice_message)
        } else {
            notice_message
        };
    } =>
    SemanticsRegion(
        identifier: Some("harbour-field-notes".to_string()),
        label: Some(cx.tr("notes.app.title")),
        child: Scroll(
            flex_grow: 1.0,
            height: cx.view.viewport_size().height,
            semantic_label: Some(cx.tr("notes.workspace.a11y")),
            child: Container(
                Column(gap: tokens.spacing.l, children: [
                    Row(gap: tokens.spacing.m, wrap: ir_op::FlexWrap::Wrap, children: [
                        Column(gap: tokens.spacing.xs, children: [
                            Text(cx.tr("notes.app.title"))
                                .weight(tokens.typography.font_weight_bold),
                            Text(cx.tr("notes.app.subtitle"))
                                .color(tokens.colors.text_secondary),
                        ]),
                        Spacer(flex_grow: 1.0),
                        Button(
                            child: Text(if app.is_loading {
                                cx.tr("notes.action.loading")
                            } else if app.has_error && app.notes.is_empty() {
                                cx.tr("notes.status.storage_unavailable")
                            } else {
                                cx.tr("notes.action.new")
                            }),
                            key: "new-field-note",
                            disabled: app.is_editing
                                || app.is_saving
                                || app.is_loading
                                || (app.has_error && app.notes.is_empty()),
                            variant: ButtonVariant::Primary,
                            on_press: reduce {
                                workspace.search.clear();
                                start_new_field_note(app);
                            },
                        ).semantics_identifier("field-notes.new".to_string()),
                    ]),
                    Grid(
                        columns: vec![GridTrack::auto_fit(GridTrack::minmax(
                            GridTrack::Points(150.0),
                            GridTrack::Fr(1.0),
                        ))],
                        rows: vec![GridTrack::Auto],
                        column_gap: tokens.spacing.m,
                        row_gap: tokens.spacing.s,
                        children: [
                            Column(children: [
                                Text(if app.is_loading {
                                    cx.tr("notes.action.loading")
                                } else if app.has_error && app.notes.is_empty() {
                                    cx.tr("notes.status.notes_unavailable")
                                } else {
                                    cx.tr("notes.summary.notes")
                                        .replace("{count}", &app.notes.len().to_string())
                                })
                                    .weight(tokens.typography.font_weight_semibold),
                                Text(cx.tr("notes.status.on_device"))
                                    .color(tokens.colors.text_secondary),
                            ]),
                            Column(children: [
                                Text(if app.is_loading {
                                    cx.tr("notes.status.reading_records")
                                } else {
                                    cx.tr("notes.status.waiting_count")
                                        .replace("{count}", &pending_count.to_string())
                                })
                                    .weight(tokens.typography.font_weight_semibold),
                                Text(cx.tr("notes.status.waiting_detail"))
                                    .color(tokens.colors.text_secondary),
                            ]),
                        ],
                    ),
                    Grid(
                        columns: vec![GridTrack::auto_fit(GridTrack::minmax(
                            GridTrack::Points(220.0),
                            GridTrack::Fr(1.0),
                        ))],
                        rows: vec![GridTrack::Auto],
                        column_gap: tokens.spacing.l,
                        row_gap: tokens.spacing.l,
                        children: [
                            Column(gap: tokens.spacing.m, children: [
                                if app.is_editing {
                                    Text(cx.tr("notes.status.finish_draft"))
                                        .color(tokens.colors.text_secondary)
                                } else {
                                    TextInput(
                                        label: Some(cx.tr("notes.field.search").into()),
                                        placeholder: Some(cx.tr("notes.field.search.placeholder").into()),
                                        bind: workspace.search,
                                        key: "field-notes-search",
                                        semantics_identifier: "field-notes.search".to_string(),
                                    )
                                },
                                Column(gap: tokens.spacing.s, children: [
                                    Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
                                        Text(cx.tr("notes.status.recent"))
                                            .weight(tokens.typography.font_weight_semibold),
                                        Spacer(flex_grow: 1.0),
                                        Text(cx.tr("notes.status.shown_waiting")
                                            .replace("{shown}", &visible_notes.len().to_string())
                                            .replace("{waiting}", &pending_count.to_string()))
                                            .color(tokens.colors.text_secondary),
                                    ]),
                                    if app.is_loading {
                                        Container(
                                            Column(gap: tokens.spacing.s, children: [
                                                Widget::from(Spinner {
                                                    id: WidgetId::explicit("field-notes-loading"),
                                                    color: None,
                                                    motion: Some(SpinnerMotion::Default),
                                                    label: Some(cx.tr("notes.status.loading_open").into()),
                                                }),
                                                Text(cx.tr("notes.status.loading_open"))
                                                    .color(tokens.colors.text_secondary),
                                            ]),
                                        )
                                        .padding_all(tokens.spacing.m)
                                        .bg(tokens.colors.surface)
                                        .border(tokens.colors.border, 1.0)
                                        .border_radius(tokens.radii.medium)
                                    } else if app.has_error && app.notes.is_empty() {
                                        Container(
                                            Column(gap: tokens.spacing.s, children: [
                                                Text(cx.tr("notes.error.open")),
                                                Text(cx.tr("notes.error.restore_access"))
                                                    .color(tokens.colors.text_secondary),
                                            ]),
                                        )
                                        .padding_all(tokens.spacing.m)
                                        .bg(tokens.colors.surface)
                                        .border(tokens.colors.border, 1.0)
                                        .border_radius(tokens.radii.medium)
                                    } else if app.notes.is_empty() {
                                        Container(
                                            Column(gap: tokens.spacing.s, children: [
                                                Text(cx.tr("notes.empty.title")),
                                                Text(cx.tr("notes.empty.help"))
                                                    .color(tokens.colors.text_secondary),
                                            ]),
                                        )
                                        .padding_all(tokens.spacing.m)
                                        .bg(tokens.colors.surface)
                                        .border(tokens.colors.border, 1.0)
                                        .border_radius(tokens.radii.medium)
                                    } else if visible_notes.is_empty() {
                                        Container(
                                            Column(gap: tokens.spacing.s, children: [
                                                Text(cx.tr("notes.empty.search")),
                                                Text(cx.tr("notes.empty.search_help"))
                                                    .color(tokens.colors.text_secondary),
                                                Button(
                                                    child: Text(cx.tr("notes.action.clear_search")),
                                                    key: "clear-field-note-search",
                                                    variant: ButtonVariant::Outline,
                                                    on_press: reduce { workspace.search.clear(); },
                                                ),
                                            ]),
                                        )
                                        .padding_all(tokens.spacing.m)
                                        .bg(tokens.colors.surface)
                                        .border(tokens.colors.border, 1.0)
                                        .border_radius(tokens.radii.medium)
                                    } else {
                                        Column(gap: tokens.spacing.s, children: [
                                            for note in visible_notes.iter() {
                                                FieldNoteListItem(
                                                    note.clone(),
                                                    selected_note.as_ref()
                                                        .map(|selected| selected.id == note.id)
                                                        .unwrap_or(false)
                                                        && !app.is_new_note,
                                                    app.is_editing || app.is_saving,
                                                    key: note.id,
                                                ).id(WidgetId::explicit(&format!("field-note.{}", note.id)))
                                            },
                                        ])
                                    },
                                ]),
                            ]),
                            Column(gap: tokens.spacing.m, children: [
                                if app.is_editing {
                                    FieldNoteEditor(app.is_new_note)
                                } else if app.is_loading {
                                    Text(cx.tr("notes.status.wait_for_load"))
                                        .color(tokens.colors.text_secondary)
                                } else if app.has_error && app.notes.is_empty() {
                                    Text(cx.tr("notes.status.storage_unavailable_detail"))
                                        .color(tokens.colors.text_secondary)
                                } else if visible_notes.is_empty() {
                                    Container(
                                        Column(gap: tokens.spacing.s, children: [
                                            Text(cx.tr("notes.empty.open_title")),
                                            Text(if app.notes.is_empty() {
                                                cx.tr("notes.empty.first_note")
                                            } else {
                                                cx.tr("notes.empty.clear_search")
                                            })
                                                .color(tokens.colors.text_secondary),
                                        ]),
                                    )
                                    .padding_all(tokens.spacing.l)
                                    .bg(tokens.colors.surface)
                                    .border(tokens.colors.border, 1.0)
                                    .border_radius(tokens.radii.large)
                                } else if let Some(note) = selected_note.clone() {
                                    FieldNoteDetail(note)
                                } else {
                                    Text(cx.tr("notes.empty.select_detail"))
                                        .color(tokens.colors.text_secondary)
                                },
                                if !app.is_editing {
                                    Text(notice).color(tokens.colors.text_secondary)
                                },
                                Text(cx.tr("notes.preview_only"))
                                    .color(tokens.colors.text_secondary),
                            ]),
                        ],
                    ),
                ]),
            )
            .padding_all(tokens.spacing.l)
            .bg(tokens.colors.background),
        ),
    )
}
{"id":"fission-tabs-1","index":4,"label":"src/widgets/mod.rs","value":"src-widgets-mod-rs"}
mod field_note_list_item;
mod field_note_detail;
mod field_note_editor;
pub use field_note_list_item::FieldNoteListItem;
pub use field_note_detail::FieldNoteDetail;
pub use field_note_editor::FieldNoteEditor;
{"id":"fission-tabs-1","index":5,"label":"src/widgets/field_note_list_item.rs","value":"src-widgets-field-note-list-item-rs"}
use fission::prelude::*;
use crate::{models::*, state::*};
fission_component! {
    pub FieldNoteListItem<FieldNotesState> {
        props {
        note: FieldNote,
        selected: bool,
        editing: bool,
        }
    }
    view(row, _app, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let selected_bg = if row.selected {
            tokens.colors.primary_subtle
        } else {
            tokens.colors.surface
        };
        let selected_border = if row.selected {
            tokens.colors.primary
        } else {
            tokens.colors.border
        };
        let status_color = if row.note.sync_status == NoteSyncStatus::WaitingToSync {
            tokens.colors.warning
        } else {
            tokens.colors.success
        };
        let status = cx.tr(row.note.sync_status.translation_key());
        let selected_label = if row.selected {
            cx.tr("notes.row.selected")
        } else {
            cx.tr("notes.action.open")
        };
    } =>
    SemanticsRegion(
        identifier: Some(format!("field-note.{}", row.note.id)),
        label: Some(format!("{}, {}", row.note.title.clone(), row.note.site.clone())),
        child: Container(
            Column(gap: tokens.spacing.s, children: [
                Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
                    Column(gap: tokens.spacing.xs, children: [
                        Text(row.note.title.clone())
                            .weight(tokens.typography.font_weight_semibold),
                        Text(row.note.site.clone())
                            .color(tokens.colors.text_secondary),
                    ]),
                    Spacer(flex_grow: 1.0),
                    Text(status).color(status_color),
                ]),
                Text(row.note.updated_at.clone())
                    .color(tokens.colors.text_secondary),
                Button(
                    child: Text(selected_label),
                    key: format!("open-field-note-{}", row.note.id),
                    disabled: row.editing || row.selected,
                    variant: ButtonVariant::Outline,
                    on_press: with_reducer!(
                        cx.build,
                        SelectFieldNote(row.note.id),
                        on_select_field_note,
                    ),
                ).semantics_identifier(format!("field-notes.open.{}", row.note.id)),
            ]),
        )
        .padding_all(tokens.spacing.m)
        .bg(selected_bg)
        .border(selected_border, 1.0)
        .border_radius(tokens.radii.medium),
    )
}
{"id":"fission-tabs-1","index":6,"label":"src/widgets/field_note_detail.rs","value":"src-widgets-field-note-detail-rs"}
use fission::prelude::*;
use crate::{models::*, state::*};
fission_component! {
    pub FieldNoteDetail<FieldNotesState> { props { note: FieldNote } }
    view(detail, app, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let waiting = detail.note.sync_status == NoteSyncStatus::WaitingToSync;
        let heading = cx.tr("notes.detail.title")
            .replace("{title}", &detail.note.title.clone());
    } =>
    SemanticsRegion(
        identifier: Some(format!("field-note.detail.{}", detail.note.id)),
        label: Some(heading),
        child: Container(
            Column(gap: tokens.spacing.m, children: [
                Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
                    Text(detail.note.site.clone()).color(tokens.colors.text_secondary),
                    Spacer(flex_grow: 1.0),
                    Text(cx.tr(detail.note.sync_status.translation_key())),
                ]),
                Text(detail.note.title.clone())
                    .weight(tokens.typography.font_weight_bold),
                Text(detail.note.observation.clone()),
                Text(cx.tr("notes.updated_revision")
                    .replace("{time}", &if detail.note.updated_at.is_empty() { cx.tr("notes.time.not_committed") } else { detail.note.updated_at.clone() })
                    .replace("{revision}", &detail.note.revision.to_string()))
                    .color(tokens.colors.text_secondary),
                if waiting {
                    Text(cx.tr("notes.detail.saved_waiting"))
                        .color(tokens.colors.text_secondary)
                } else {
                    Text(cx.tr("notes.detail.synced"))
                        .color(tokens.colors.text_secondary)
                },
                Button(
                    child: Text(cx.tr("notes.action.edit")),
                    key: format!("edit-field-note-{}", detail.note.id),
                    disabled: app.is_editing,
                    variant: ButtonVariant::Primary,
                    on_press: with_reducer!(
                        cx.build,
                        BeginEditFieldNote(detail.note.id),
                        on_begin_edit_field_note,
                    ),
                ).semantics_identifier(format!("field-notes.edit.{}", detail.note.id)),
            ]),
        )
        .padding_all(tokens.spacing.l)
        .bg(tokens.colors.surface)
        .border(tokens.colors.border, 1.0)
        .border_radius(tokens.radii.large),
    )
}
{"id":"fission-tabs-1","index":7,"label":"src/widgets/field_note_editor.rs","value":"src-widgets-field-note-editor-rs"}
use fission::prelude::*;
use crate::{models::*, state::*};
fission_component! {
    pub FieldNoteEditor<FieldNotesState> { props { new_note: bool } }
    view(editor, app, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let heading = if editor.new_note {
            cx.tr("notes.editor.new")
        } else {
            cx.tr("notes.editor.edit")
        };
        let missing_required_fields = app.site_draft.trim().is_empty()
            || app.title_draft.trim().is_empty()
            || app.observation_draft.trim().is_empty();
        let notice = if app.has_error && app.validation_error && !missing_required_fields {
            cx.tr("notes.notice.fields_complete")
        } else if app.has_error {
            cx.tr("notes.status.needs_attention")
                .replace("{message}", &cx.tr(&app.notice))
        } else {
            cx.tr(&app.notice)
        };
    } =>
    SemanticsRegion(
        identifier: Some("field-notes.editor".to_string()),
        label: Some(heading.to_string()),
        child: Container(
            Column(gap: tokens.spacing.m, children: [
                Text(heading).weight(tokens.typography.font_weight_bold),
                Text(cx.tr("notes.editor.help"))
                    .color(tokens.colors.text_secondary),
                TextInput(
                    label: Some(cx.tr("notes.field.site").into()),
                    placeholder: Some(cx.tr("notes.field.site.placeholder").into()),
                    bind: app.site_draft,
                    enabled: !app.is_saving,
                    key: "field-note-site",
                    semantics_identifier: "field-notes.site".to_string(),
                ),
                TextInput(
                    label: Some(cx.tr("notes.field.title").into()),
                    placeholder: Some(cx.tr("notes.field.title.placeholder").into()),
                    bind: app.title_draft,
                    enabled: !app.is_saving,
                    key: "field-note-title",
                    semantics_identifier: "field-notes.title".to_string(),
                ),
                TextInput(
                    label: Some(cx.tr("notes.field.observation").into()),
                    placeholder: Some(cx.tr("notes.field.observation.placeholder").into()),
                    multiline: true,
                    min_lines: Some(5),
                    max_lines: Some(9),
                    bind: app.observation_draft,
                    enabled: !app.is_saving,
                    key: "field-note-observation",
                    semantics_identifier: "field-notes.observation".to_string(),
                ),
                Text(notice).color(tokens.colors.text_secondary),
                Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
                    Button(
                        child: Text(if app.is_saving {
                            cx.tr("notes.status.saving")
                        } else {
                            cx.tr("notes.action.save")
                        }),
                        key: "save-field-note",
                        variant: ButtonVariant::Primary,
                        disabled: app.is_saving,
                        on_press: with_reducer!(
                            cx.build,
                            SaveFieldNote,
                            on_save_field_note,
                        ),
                    ).semantics_identifier("field-notes.save".to_string()),
                    Button(
                        child: Text(cx.tr("notes.action.cancel")),
                        key: "cancel-field-note-draft",
                        variant: ButtonVariant::Outline,
                        disabled: app.is_saving,
                        on_press: with_reducer!(
                            cx.build,
                            CancelFieldNoteDraft,
                            on_cancel_field_note_draft,
                        ),
                    ).semantics_identifier("field-notes.cancel".to_string()),
                ]),
            ]),
        )
        .padding_all(tokens.spacing.l)
        .bg(tokens.colors.surface)
        .border(tokens.colors.border, 1.0)
        .border_radius(tokens.radii.large),
    )
}
{"id":"fission-tabs-1","index":8,"label":"preview/lib.rs","value":"preview-lib-rs"}
mod app;
mod models;
mod state;
mod widgets;
mod translations;
#[path = "../preview/fixtures.rs"]
mod fixtures;

use state::FieldNotesState;
use fission::prelude::*;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(start)]
pub fn run() -> Result<(), JsValue> {
    console_error_panic_hook::set_once();
    WebApp::<FieldNotesState, _>::new(app::FieldNotesWorkspace::new())
        .with_env(translations::create_env())
        .with_state_init(|state| {
            state.notes = fixtures::sample_notes();
            state.selected_note_id = Some(501);
            state.next_note_id = 504;
        })
        .with_title("Harbour Field Notes · Offline notebook")
        .mount("#fission-web-mount")
        .run()
        .map_err(|error| JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1"}
FieldNotesWorkspace derives search results and the waiting count from FieldNotesState. The row and detail components receive the same FieldNote; reducers own selection and saving. If search hides the selected note, the first matching result becomes the detail view too. The page won’t leave an unrelated note open. Search for inverter, edit its observation, and save. Its revision advances and it waits to sync; the other notes stay unchanged. Starting a new note clears search so the new record remains visible.
Search for “inverter”, edit the observation, and save it. Then choose New field note, leave the observation blank, and try to save. The validation message should keep the draft open; after adding a worksite, title, and observation, the new note should appear in the list as waiting to sync.
Show the app preview
Hide the app preview

3. Persist each revision and ignore stale sync results

The earlier editing checkpoint uses sample visits in memory. This final checkpoint starts empty and loads the real database on both Web and native targets; sample visits belong in an explicit demo mode, not in a technician’s work history. In the native app, Saved on this device means SQLite committed the note. A network effect should only start after that commit succeeds. This tutorial leaves that effect and its server endpoint out, so notes remain waiting to sync. If the local write fails, keep the editor open and report the storage error; don’t say the note was saved.
SQLite allocates each durable note ID. The editor snapshots an optional existing ID for updates; new notes do not derive their identity from a list index or the current maximum ID. Start with a migration for the worksite, title, observation, revision and sync status. The revision matters: if revision 5 is sent while the technician writes revision 6, a late response for revision 5 must not mark the newer text as synced. SQLite stores updated_at as UTC text; format it for the device’s locale before showing it. The earlier preview uses shorter display strings. Database timestamps are UTC; this compact example leaves them as UTC rather than pretending an untranslated local time was produced.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"src/models.rs","value":"src-models-rs"},{"index":1,"label":"src/state.rs","value":"src-state-rs"},{"index":2,"label":"src/translations.rs","value":"src-translations-rs"},{"index":3,"label":"src/app.rs","value":"src-app-rs"},{"index":4,"label":"src/widgets/mod.rs","value":"src-widgets-mod-rs"},{"index":5,"label":"src/widgets/field_note_list_item.rs","value":"src-widgets-field-note-list-item-rs"},{"index":6,"label":"src/widgets/field_note_detail.rs","value":"src-widgets-field-note-detail-rs"},{"index":7,"label":"src/widgets/field_note_editor.rs","value":"src-widgets-field-note-editor-rs"},{"index":8,"label":"src/storage.rs","value":"src-storage-rs"},{"index":9,"label":"src/lib.rs","value":"src-lib-rs"},{"index":10,"label":"preview/lib.rs","value":"preview-lib-rs"}]}
{"id":"fission-tabs-1","index":0,"label":"src/models.rs","value":"src-models-rs"}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum NoteSyncStatus {
    Synced,
    WaitingToSync,
}

impl NoteSyncStatus {
    pub fn translation_key(&self) -> &'static str {
        match self {
            Self::Synced => "notes.sync.synced",
            Self::WaitingToSync => "notes.sync.waiting",
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct FieldNote {
    pub id: i64,
    pub site: String,
    pub title: String,
    pub observation: String,
    pub updated_at: String,
    pub revision: u32,
    pub sync_status: NoteSyncStatus,
}

pub fn matches_note(note: &FieldNote, query: &str) -> bool {
    query.is_empty()
        || note.site.to_lowercase().contains(query)
        || note.title.to_lowercase().contains(query)
        || note.observation.to_lowercase().contains(query)
}
#[derive(Clone, Debug, PartialEq)]
pub struct PendingFieldNote {
    pub target_id: Option<i64>,
    pub site: String,
    pub title: String,
    pub observation: String,
    pub revision: u32,
}

{"id":"fission-tabs-1","index":1,"label":"src/state.rs","value":"src-state-rs"}
use fission::prelude::*;
use crate::models::*;
#[derive(Clone, Debug, PartialEq)]
pub struct FieldNotesState {
    pub notes: Vec<FieldNote>,
    pub selected_note_id: Option<i64>,
        pub pending_note: Option<PendingFieldNote>,
    pub site_draft: String,
    pub title_draft: String,
    pub observation_draft: String,
    pub is_editing: bool,
    pub is_new_note: bool,
    pub is_saving: bool,
    pub is_loading: bool,
    pub requires_reload: bool,
    pub notice: String,
    pub has_error: bool,
    pub validation_error: bool,
}

impl Default for FieldNotesState {
    fn default() -> Self {
        Self {
            notes: Vec::new(),
            selected_note_id: None,
            pending_note: None,
            site_draft: String::new(),
            title_draft: String::new(),
            observation_draft: String::new(),
            is_editing: false,
            is_new_note: false,
            is_saving: false,
            is_loading: true,
            requires_reload: false,
            notice: "notes.notice.ready".into(),
            has_error: false,
            validation_error: false,
        }
    }
}

impl GlobalState for FieldNotesState {}

#[fission_reducer(SelectFieldNote)]
pub fn on_select_field_note(state: &mut FieldNotesState, note_id: i64) {
    if state.is_editing || state.is_saving {
        return;
    }
    if state.notes.iter().any(|note| note.id == note_id) {
        state.selected_note_id = Some(note_id);
        state.notice.clear();
        state.has_error = false;
        state.validation_error = false;
    }
}

pub fn start_new_field_note(state: &mut FieldNotesState) {
    if state.is_editing || state.is_saving {
        return;
    }
    state.site_draft.clear();
    state.title_draft.clear();
    state.observation_draft.clear();
    state.pending_note = None;
    state.is_editing = true;
    state.is_new_note = true;
    state.notice = "notes.notice.new_prompt".into();
    state.has_error = false;
    state.validation_error = false;
}

#[fission_reducer(BeginNewFieldNote)]
pub fn on_begin_new_field_note(
    state: &mut FieldNotesState,
    _ctx: &mut ReducerContext<FieldNotesState>,
) {
    start_new_field_note(state);
}

#[fission_reducer(BeginEditFieldNote)]
pub fn on_begin_edit_field_note(state: &mut FieldNotesState, note_id: i64) {
    if state.is_editing || state.is_saving {
        return;
    }
    let Some(note) = state.notes.iter().find(|note| note.id == note_id).cloned() else {
        state.notice = "notes.notice.missing".into();
        state.has_error = true;
        state.validation_error = false;
        return;
    };
    state.selected_note_id = Some(note_id);
    state.site_draft = note.site;
    state.title_draft = note.title;
    state.observation_draft = note.observation;
    state.is_editing = true;
    state.is_new_note = false;
    state.notice = "notes.notice.editing".into();
    state.has_error = false;
    state.validation_error = false;
}

#[fission_reducer(CancelFieldNoteDraft)]
pub fn on_cancel_field_note_draft(state: &mut FieldNotesState) {
    if state.is_saving {
        return;
    }
    state.site_draft.clear();
    state.title_draft.clear();
    state.observation_draft.clear();
    state.pending_note = None;
    state.is_editing = false;
    state.is_new_note = false;
    state.notice = "notes.notice.draft_discarded".into();
    state.has_error = false;
    state.validation_error = false;
}
{"id":"fission-tabs-1","index":2,"label":"src/translations.rs","value":"src-translations-rs"}
use fission::i18n::{Locale, TranslationBundle};
use fission::prelude::*;
use std::collections::HashMap;

pub fn create_env() -> Env {
    let mut env = Env::default();
    env.locale = Locale::from("en-US");
    for (locale, yaml) in [
        ("en-US", include_str!("../i18n/en-US.yaml")),
        ("es-ES", include_str!("../i18n/es-ES.yaml")),
    ] {
        let messages: HashMap<String, String> =
            serde_yaml::from_str(yaml).expect("valid Harbour Field Notes translations");
        env.i18n.add_bundle(TranslationBundle {
            locale: Locale::from(locale),
            messages,
        });
    }
    env
}
{"id":"fission-tabs-1","index":3,"label":"src/app.rs","value":"src-app-rs"}
use fission::prelude::*;
use crate::{models::*, state::*};
use crate::widgets::*;
use crate::storage::*;
fission_component! {
    pub FieldNotesWorkspace<FieldNotesState> {
        state {
            search: String = String::new(),
        }
    }
    view(workspace, app, cx) {
        let _startup = cx.bind(PrepareFieldNotes, reduce!(prepare_field_notes));
        let tokens = &cx.view.env().theme.tokens;
        let query = workspace.search.trim().to_lowercase();
        let visible_notes: Vec<FieldNote> = app.notes.iter()
            .filter(|note| matches_note(note, &query))
            .cloned()
            .collect();
        let selected_note = visible_notes.iter()
            .find(|note| Some(note.id) == app.selected_note_id)
            .or_else(|| visible_notes.first())
            .cloned();
        let pending_count = app.notes.iter()
            .filter(|note| note.sync_status == NoteSyncStatus::WaitingToSync)
            .count();
        let notice_message = if let Some((key, count)) = app.notice.split_once('|') {
            cx.tr(key).replace("{count}", count)
        } else {
            cx.tr(&app.notice)
        };
        let notice = if app.has_error {
            cx.tr("notes.status.needs_attention").replace("{message}", &notice_message)
        } else {
            notice_message
        };
    } =>
    SemanticsRegion(
        identifier: Some("harbour-field-notes".to_string()),
        label: Some(cx.tr("notes.app.title")),
        child: Scroll(
            flex_grow: 1.0,
            height: cx.view.viewport_size().height,
            semantic_label: Some(cx.tr("notes.workspace.a11y")),
            child: Container(
                Column(gap: tokens.spacing.l, children: [
                    if app.requires_reload {
                        Button(
                            child: Text(cx.tr("notes.action.reload_discard")),
                            key: "reload-field-notes",
                            on_press: reduce {
                                app.is_editing = false;
                                app.is_new_note = false;
                                app.site_draft.clear();
                                app.title_draft.clear();
                                app.observation_draft.clear();
                                app.pending_note = None;
                                prepare_field_notes(app, PrepareFieldNotes, cx);
                            },
                        )
                    },
                    Row(gap: tokens.spacing.m, wrap: ir_op::FlexWrap::Wrap, children: [
                        Column(gap: tokens.spacing.xs, children: [
                            Text(cx.tr("notes.app.title"))
                                .weight(tokens.typography.font_weight_bold),
                            Text(cx.tr("notes.app.subtitle"))
                                .color(tokens.colors.text_secondary),
                        ]),
                        Spacer(flex_grow: 1.0),
                        Button(
                            child: Text(if app.is_loading {
                                cx.tr("notes.action.loading")
                            } else if app.has_error && app.notes.is_empty() {
                                cx.tr("notes.status.storage_unavailable")
                            } else {
                                cx.tr("notes.action.new")
                            }),
                            key: "new-field-note",
                            disabled: app.is_editing
                                || app.is_saving
                                || app.is_loading
                                || app.requires_reload
                                || (app.has_error && app.notes.is_empty()),
                            variant: ButtonVariant::Primary,
                            on_press: reduce {
                                workspace.search.clear();
                                start_new_field_note(app);
                            },
                        ).semantics_identifier("field-notes.new".to_string()),
                    ]),
                    Grid(
                        columns: vec![GridTrack::auto_fit(GridTrack::minmax(
                            GridTrack::Points(150.0),
                            GridTrack::Fr(1.0),
                        ))],
                        rows: vec![GridTrack::Auto],
                        column_gap: tokens.spacing.m,
                        row_gap: tokens.spacing.s,
                        children: [
                            Column(children: [
                                Text(if app.is_loading {
                                    cx.tr("notes.action.loading")
                                } else if app.has_error && app.notes.is_empty() {
                                    cx.tr("notes.status.notes_unavailable")
                                } else {
                                    cx.tr("notes.summary.notes")
                                        .replace("{count}", &app.notes.len().to_string())
                                })
                                    .weight(tokens.typography.font_weight_semibold),
                                Text(cx.tr("notes.status.on_device"))
                                    .color(tokens.colors.text_secondary),
                            ]),
                            Column(children: [
                                Text(if app.is_loading {
                                    cx.tr("notes.status.reading_records")
                                } else {
                                    cx.tr("notes.status.waiting_count")
                                        .replace("{count}", &pending_count.to_string())
                                })
                                    .weight(tokens.typography.font_weight_semibold),
                                Text(cx.tr("notes.status.waiting_detail"))
                                    .color(tokens.colors.text_secondary),
                            ]),
                        ],
                    ),
                    Grid(
                        columns: vec![GridTrack::auto_fit(GridTrack::minmax(
                            GridTrack::Points(220.0),
                            GridTrack::Fr(1.0),
                        ))],
                        rows: vec![GridTrack::Auto],
                        column_gap: tokens.spacing.l,
                        row_gap: tokens.spacing.l,
                        children: [
                            Column(gap: tokens.spacing.m, children: [
                                if app.is_editing {
                                    Text(cx.tr("notes.status.finish_draft"))
                                        .color(tokens.colors.text_secondary)
                                } else {
                                    TextInput(
                                        label: Some(cx.tr("notes.field.search").into()),
                                        placeholder: Some(cx.tr("notes.field.search.placeholder").into()),
                                        bind: workspace.search,
                                        key: "field-notes-search",
                                        semantics_identifier: "field-notes.search".to_string(),
                                    )
                                },
                                Column(gap: tokens.spacing.s, children: [
                                    Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
                                        Text(cx.tr("notes.status.recent"))
                                            .weight(tokens.typography.font_weight_semibold),
                                        Spacer(flex_grow: 1.0),
                                        Text(cx.tr("notes.status.shown_waiting")
                                            .replace("{shown}", &visible_notes.len().to_string())
                                            .replace("{waiting}", &pending_count.to_string()))
                                            .color(tokens.colors.text_secondary),
                                    ]),
                                    if app.is_loading {
                                        Container(
                                            Column(gap: tokens.spacing.s, children: [
                                                Widget::from(Spinner {
                                                    id: WidgetId::explicit("field-notes-loading"),
                                                    color: None,
                                                    motion: Some(SpinnerMotion::Default),
                                                    label: Some(cx.tr("notes.status.loading_open").into()),
                                                }),
                                                Text(cx.tr("notes.status.loading_open"))
                                                    .color(tokens.colors.text_secondary),
                                            ]),
                                        )
                                        .padding_all(tokens.spacing.m)
                                        .bg(tokens.colors.surface)
                                        .border(tokens.colors.border, 1.0)
                                        .border_radius(tokens.radii.medium)
                                    } else if app.has_error && app.notes.is_empty() {
                                        Container(
                                            Column(gap: tokens.spacing.s, children: [
                                                Text(cx.tr("notes.error.open")),
                                                Text(cx.tr("notes.error.restore_access"))
                                                    .color(tokens.colors.text_secondary),
                                            ]),
                                        )
                                        .padding_all(tokens.spacing.m)
                                        .bg(tokens.colors.surface)
                                        .border(tokens.colors.border, 1.0)
                                        .border_radius(tokens.radii.medium)
                                    } else if app.notes.is_empty() {
                                        Container(
                                            Column(gap: tokens.spacing.s, children: [
                                                Text(cx.tr("notes.empty.title")),
                                                Text(cx.tr("notes.empty.help"))
                                                    .color(tokens.colors.text_secondary),
                                            ]),
                                        )
                                        .padding_all(tokens.spacing.m)
                                        .bg(tokens.colors.surface)
                                        .border(tokens.colors.border, 1.0)
                                        .border_radius(tokens.radii.medium)
                                    } else if visible_notes.is_empty() {
                                        Container(
                                            Column(gap: tokens.spacing.s, children: [
                                                Text(cx.tr("notes.empty.search")),
                                                Text(cx.tr("notes.empty.search_help"))
                                                    .color(tokens.colors.text_secondary),
                                                Button(
                                                    child: Text(cx.tr("notes.action.clear_search")),
                                                    key: "clear-field-note-search",
                                                    variant: ButtonVariant::Outline,
                                                    on_press: reduce { workspace.search.clear(); },
                                                ),
                                            ]),
                                        )
                                        .padding_all(tokens.spacing.m)
                                        .bg(tokens.colors.surface)
                                        .border(tokens.colors.border, 1.0)
                                        .border_radius(tokens.radii.medium)
                                    } else {
                                        Column(gap: tokens.spacing.s, children: [
                                            for note in visible_notes.iter() {
                                                FieldNoteListItem(
                                                    note.clone(),
                                                    selected_note.as_ref()
                                                        .map(|selected| selected.id == note.id)
                                                        .unwrap_or(false)
                                                        && !app.is_new_note,
                                                    app.is_editing || app.is_saving || app.requires_reload,
                                                    key: note.id,
                                                ).id(WidgetId::explicit(&format!("field-note.{}", note.id)))
                                            },
                                        ])
                                    },
                                ]),
                            ]),
                            Column(gap: tokens.spacing.m, children: [
                                if app.is_editing {
                                    FieldNoteEditor(app.is_new_note)
                                } else if app.is_loading {
                                    Text(cx.tr("notes.status.wait_for_load"))
                                        .color(tokens.colors.text_secondary)
                                } else if app.has_error && app.notes.is_empty() {
                                    Text(cx.tr("notes.status.storage_unavailable_detail"))
                                        .color(tokens.colors.text_secondary)
                                } else if visible_notes.is_empty() {
                                    Container(
                                        Column(gap: tokens.spacing.s, children: [
                                            Text(cx.tr("notes.empty.open_title")),
                                            Text(if app.notes.is_empty() {
                                                cx.tr("notes.empty.first_note")
                                            } else {
                                                cx.tr("notes.empty.clear_search")
                                            })
                                                .color(tokens.colors.text_secondary),
                                        ]),
                                    )
                                    .padding_all(tokens.spacing.l)
                                    .bg(tokens.colors.surface)
                                    .border(tokens.colors.border, 1.0)
                                    .border_radius(tokens.radii.large)
                                } else if let Some(note) = selected_note.clone() {
                                    FieldNoteDetail(note)
                                } else {
                                    Text(cx.tr("notes.empty.select_detail"))
                                        .color(tokens.colors.text_secondary)
                                },
                                if !app.is_editing {
                                    Text(notice).color(tokens.colors.text_secondary)
                                },
                            ]),
                        ],
                    ),
                ]),
            )
            .padding_all(tokens.spacing.l)
            .bg(tokens.colors.background),
        ),
    )
}
{"id":"fission-tabs-1","index":4,"label":"src/widgets/mod.rs","value":"src-widgets-mod-rs"}
mod field_note_list_item;
mod field_note_detail;
mod field_note_editor;
pub use field_note_list_item::FieldNoteListItem;
pub use field_note_detail::FieldNoteDetail;
pub use field_note_editor::FieldNoteEditor;
{"id":"fission-tabs-1","index":5,"label":"src/widgets/field_note_list_item.rs","value":"src-widgets-field-note-list-item-rs"}
use fission::prelude::*;
use crate::{models::*, state::*};
fission_component! {
    pub FieldNoteListItem<FieldNotesState> {
        props {
        note: FieldNote,
        selected: bool,
        editing: bool,
        }
    }
    view(row, _app, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let selected_bg = if row.selected {
            tokens.colors.primary_subtle
        } else {
            tokens.colors.surface
        };
        let selected_border = if row.selected {
            tokens.colors.primary
        } else {
            tokens.colors.border
        };
        let status_color = if row.note.sync_status == NoteSyncStatus::WaitingToSync {
            tokens.colors.warning
        } else {
            tokens.colors.success
        };
        let status = cx.tr(row.note.sync_status.translation_key());
        let selected_label = if row.selected {
            cx.tr("notes.row.selected")
        } else {
            cx.tr("notes.action.open")
        };
    } =>
    SemanticsRegion(
        identifier: Some(format!("field-note.{}", row.note.id)),
        label: Some(format!("{}, {}", row.note.title.clone(), row.note.site.clone())),
        child: Container(
            Column(gap: tokens.spacing.s, children: [
                Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
                    Column(gap: tokens.spacing.xs, children: [
                        Text(row.note.title.clone())
                            .weight(tokens.typography.font_weight_semibold),
                        Text(row.note.site.clone())
                            .color(tokens.colors.text_secondary),
                    ]),
                    Spacer(flex_grow: 1.0),
                    Text(status).color(status_color),
                ]),
                Text(row.note.updated_at.clone())
                    .color(tokens.colors.text_secondary),
                Button(
                    child: Text(selected_label),
                    key: format!("open-field-note-{}", row.note.id),
                    disabled: row.editing || row.selected,
                    variant: ButtonVariant::Outline,
                    on_press: with_reducer!(
                        cx.build,
                        SelectFieldNote(row.note.id),
                        on_select_field_note,
                    ),
                ).semantics_identifier(format!("field-notes.open.{}", row.note.id)),
            ]),
        )
        .padding_all(tokens.spacing.m)
        .bg(selected_bg)
        .border(selected_border, 1.0)
        .border_radius(tokens.radii.medium),
    )
}
{"id":"fission-tabs-1","index":6,"label":"src/widgets/field_note_detail.rs","value":"src-widgets-field-note-detail-rs"}
use fission::prelude::*;
use crate::{models::*, state::*};
fission_component! {
    pub FieldNoteDetail<FieldNotesState> { props { note: FieldNote } }
    view(detail, app, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let waiting = detail.note.sync_status == NoteSyncStatus::WaitingToSync;
        let heading = cx.tr("notes.detail.title")
            .replace("{title}", &detail.note.title.clone());
    } =>
    SemanticsRegion(
        identifier: Some(format!("field-note.detail.{}", detail.note.id)),
        label: Some(heading),
        child: Container(
            Column(gap: tokens.spacing.m, children: [
                Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
                    Text(detail.note.site.clone()).color(tokens.colors.text_secondary),
                    Spacer(flex_grow: 1.0),
                    Text(cx.tr(detail.note.sync_status.translation_key())),
                ]),
                Text(detail.note.title.clone())
                    .weight(tokens.typography.font_weight_bold),
                Text(detail.note.observation.clone()),
                Text(cx.tr("notes.updated_revision")
                    .replace("{time}", &if detail.note.updated_at.is_empty() { cx.tr("notes.time.not_committed") } else { detail.note.updated_at.clone() })
                    .replace("{revision}", &detail.note.revision.to_string()))
                    .color(tokens.colors.text_secondary),
                if waiting {
                    Text(cx.tr("notes.detail.saved_waiting"))
                        .color(tokens.colors.text_secondary)
                } else {
                    Text(cx.tr("notes.detail.synced"))
                        .color(tokens.colors.text_secondary)
                },
                Button(
                    child: Text(cx.tr("notes.action.edit")),
                    key: format!("edit-field-note-{}", detail.note.id),
                    disabled: app.is_editing || app.is_saving || app.requires_reload,
                    variant: ButtonVariant::Primary,
                    on_press: with_reducer!(
                        cx.build,
                        BeginEditFieldNote(detail.note.id),
                        on_begin_edit_field_note,
                    ),
                ).semantics_identifier(format!("field-notes.edit.{}", detail.note.id)),
            ]),
        )
        .padding_all(tokens.spacing.l)
        .bg(tokens.colors.surface)
        .border(tokens.colors.border, 1.0)
        .border_radius(tokens.radii.large),
    )
}
{"id":"fission-tabs-1","index":7,"label":"src/widgets/field_note_editor.rs","value":"src-widgets-field-note-editor-rs"}
use fission::prelude::*;
use crate::storage::{SaveFieldNoteToSqlite, save_field_note_to_sqlite};
use crate::{models::*, state::*};
fission_component! {
    pub FieldNoteEditor<FieldNotesState> { props { new_note: bool } }
    view(editor, app, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let heading = if editor.new_note {
            cx.tr("notes.editor.new")
        } else {
            cx.tr("notes.editor.edit")
        };
        let missing_required_fields = app.site_draft.trim().is_empty()
            || app.title_draft.trim().is_empty()
            || app.observation_draft.trim().is_empty();
        let notice = if app.has_error && app.validation_error && !missing_required_fields {
            cx.tr("notes.notice.fields_complete")
        } else if app.has_error {
            cx.tr("notes.status.needs_attention")
                .replace("{message}", &cx.tr(&app.notice))
        } else {
            cx.tr(&app.notice)
        };
    } =>
    SemanticsRegion(
        identifier: Some("field-notes.editor".to_string()),
        label: Some(heading.to_string()),
        child: Container(
            Column(gap: tokens.spacing.m, children: [
                Text(heading).weight(tokens.typography.font_weight_bold),
                Text(cx.tr("notes.editor.help"))
                    .color(tokens.colors.text_secondary),
                TextInput(
                    label: Some(cx.tr("notes.field.site").into()),
                    placeholder: Some(cx.tr("notes.field.site.placeholder").into()),
                    bind: app.site_draft,
                    enabled: !app.is_saving && !app.requires_reload,
                    key: "field-note-site",
                    semantics_identifier: "field-notes.site".to_string(),
                ),
                TextInput(
                    label: Some(cx.tr("notes.field.title").into()),
                    placeholder: Some(cx.tr("notes.field.title.placeholder").into()),
                    bind: app.title_draft,
                    enabled: !app.is_saving,
                    key: "field-note-title",
                    semantics_identifier: "field-notes.title".to_string(),
                ),
                TextInput(
                    label: Some(cx.tr("notes.field.observation").into()),
                    placeholder: Some(cx.tr("notes.field.observation.placeholder").into()),
                    multiline: true,
                    min_lines: Some(5),
                    max_lines: Some(9),
                    bind: app.observation_draft,
                    enabled: !app.is_saving,
                    key: "field-note-observation",
                    semantics_identifier: "field-notes.observation".to_string(),
                ),
                Text(notice).color(tokens.colors.text_secondary),
                Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
                    Button(
                        child: Text(if app.is_saving {
                            cx.tr("notes.status.saving")
                        } else {
                            cx.tr("notes.action.save")
                        }),
                        key: "save-field-note",
                        variant: ButtonVariant::Primary,
                        disabled: app.is_saving || app.requires_reload,
                        on_press: with_reducer!(
                            cx.build,
                            SaveFieldNoteToSqlite,
                            save_field_note_to_sqlite,
                        ),
                    ).semantics_identifier("field-notes.save".to_string()),
                    Button(
                        child: Text(cx.tr("notes.action.cancel")),
                        key: "cancel-field-note-draft",
                        variant: ButtonVariant::Outline,
                        disabled: app.is_saving,
                        on_press: with_reducer!(
                            cx.build,
                            CancelFieldNoteDraft,
                            on_cancel_field_note_draft,
                        ),
                    ).semantics_identifier("field-notes.cancel".to_string()),
                ]),
            ]),
        )
        .padding_all(tokens.spacing.l)
        .bg(tokens.colors.surface)
        .border(tokens.colors.border, 1.0)
        .border_radius(tokens.radii.large),
    )
}
{"id":"fission-tabs-1","index":8,"label":"src/storage.rs","value":"src-storage-rs"}
use fission::prelude::*;
use crate::{models::*, state::*};

#[fission_reducer(PrepareFieldNotes)]
pub fn prepare_field_notes(
    _state: &mut FieldNotesState,
    ctx: &mut ReducerContext<FieldNotesState>,
) {
    if _state.is_saving { return; }
    _state.is_loading = true;
    _state.has_error = false;
    let mut migrations = SqlMigrations::new();
    migrations.add(SqlMigration::new(
        1,
        "create field notes",
        "CREATE TABLE field_notes (
            id INTEGER PRIMARY KEY,
            site TEXT NOT NULL CHECK (length(trim(site)) > 0),
            title TEXT NOT NULL CHECK (length(trim(title)) > 0),
            observation TEXT NOT NULL CHECK (length(trim(observation)) > 0),
            revision INTEGER NOT NULL DEFAULT 1 CHECK (revision > 0),
            sync_status TEXT NOT NULL DEFAULT 'waiting',
            updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
        );
        CREATE INDEX field_notes_site_updated_idx
            ON field_notes(site, updated_at DESC);",
    )).expect("migration versions are unique");

    let loaded = ctx.effects.bind(LoadFieldNotes, reduce!(load_field_notes));
    let failed = ctx.effects.bind(FieldNotesStorageFailed, reduce!(field_notes_storage_failed));
    ctx.effects.sql().migrate(migrations)
        .on_ok(loaded).on_err(failed);
}

#[fission_reducer(LoadFieldNotes)]
pub fn load_field_notes(
    _state: &mut FieldNotesState,
    ctx: &mut ReducerContext<FieldNotesState>,
) {
    let loaded = ctx.effects.bind(FieldNotesLoaded, reduce!(field_notes_loaded));
    let failed = ctx.effects.bind(FieldNotesStorageFailed, reduce!(field_notes_storage_failed));
    ctx.effects.sql().query(SqlStatement::new(
        "SELECT id, site, title, observation, revision, sync_status, updated_at
         FROM field_notes
         ORDER BY updated_at DESC, id DESC LIMIT 501",
    ))
    .on_ok(loaded).on_err(failed);
}

#[fission_reducer(FieldNotesLoaded)]
pub fn field_notes_loaded(
    state: &mut FieldNotesState,
    ctx: &mut ReducerContext<FieldNotesState>,
) {
    let Some(rows) = ctx.input.sql_rows() else {
        state.is_loading = false;
        state.has_error = true;
        state.requires_reload = true;
        state.notice = "notes.notice.sqlite_empty".into();
        return;
    };
    if rows.rows.len() > 500 {
        state.is_loading = false;
        state.has_error = true;
        state.requires_reload = true;
        state.notice = "notes.notice.limit".into();
        return;
    }
    let loaded_notes: Result<Vec<FieldNote>, String> = rows.rows.iter().map(|row| {
        let id = row.get::<i64>("id").map_err(|error| error.to_string())?;
        let site = row.get::<String>("site").map_err(|error| error.to_string())?;
        let title = row.get::<String>("title").map_err(|error| error.to_string())?;
        let observation = row.get::<String>("observation")
            .map_err(|error| error.to_string())?;
        let revision = u32::try_from(
            row.get::<i64>("revision").map_err(|error| error.to_string())?,
        )
        .map_err(|_| "revision is outside the supported range".to_string())?;
        let status = row.get::<String>("sync_status")
            .map_err(|error| error.to_string())?;
        let sync_status = match status.as_str() {
            "synced" => NoteSyncStatus::Synced,
            "waiting" => NoteSyncStatus::WaitingToSync,
            other => return Err(format!("unknown sync status `{other}`")),
        };
        let updated_at = row.get::<String>("updated_at")
            .map_err(|error| error.to_string())?;
        Ok(FieldNote {
            id,
            site,
            title,
            observation,
            updated_at,
            revision,
            sync_status,
        })
    }).collect();

    state.notes = match loaded_notes {
        Ok(notes) => notes,
        Err(_error) => {
            state.is_loading = false;
            state.has_error = true;
            state.validation_error = false;
            state.requires_reload = true;
            state.notice = "notes.notice.read_failed".into();
            return;
        }
    };
    state.is_loading = false;
    state.has_error = false;
    state.requires_reload = false;

    if let Some(note) = state.notes.first() {
        state.selected_note_id = Some(note.id);
    }
}

#[fission_reducer(FieldNotesStorageFailed)]
pub fn field_notes_storage_failed(
    state: &mut FieldNotesState,
    _ctx: &mut ReducerContext<FieldNotesState>,
) {
    state.is_loading = false;
    state.is_saving = false;
    state.requires_reload = true;
    state.has_error = true;
    state.validation_error = false;
    state.notice = "notes.notice.storage_failed".into();
}

#[fission_reducer(SaveFieldNoteToSqlite)]
pub fn save_field_note_to_sqlite(
    state: &mut FieldNotesState,
    ctx: &mut ReducerContext<FieldNotesState>,
) {
    if state.is_saving || state.is_loading || state.requires_reload || !state.is_editing { return; }
    let site = state.site_draft.trim().to_owned();
    let title = state.title_draft.trim().to_owned();
    let observation = state.observation_draft.trim().to_owned();
    if site.is_empty() || title.is_empty() || observation.is_empty()
        || site.chars().count() > 80 || title.chars().count() > 160 || observation.chars().count() > 4000 {
        state.notice = "notes.notice.required".into();
        state.has_error = true;
        state.validation_error = true;
        return;
    }

    let (target_id, revision) = if state.is_new_note {
        if state.notes.len() >= 500 {
            state.notice = "notes.notice.limit".into();
            state.has_error = true;
            return;
        }
        (None, 1)
    } else {
        let Some(current) = state.notes.iter().find(|note| Some(note.id) == state.selected_note_id) else { return; };
        let Some(revision) = current.revision.checked_add(1) else {
            state.notice = "notes.notice.newer_revision".into();
            state.has_error = true;
            return;
        };
        (Some(current.id), revision)
    };

    let statement = match target_id {
        None => SqlStatement::new(
            "INSERT INTO field_notes (site, title, observation, revision, sync_status, updated_at)
             VALUES (:site, :title, :observation, 1, 'waiting', CURRENT_TIMESTAMP)"
        ),
        Some(id) => SqlStatement::new(
            "UPDATE field_notes SET site = :site, title = :title, observation = :observation,
             revision = :revision, sync_status = 'waiting', updated_at = CURRENT_TIMESTAMP
             WHERE id = :id AND revision = :previous_revision"
        ).bind_named(":id", id)
         .bind_named(":revision", i64::from(revision))
         .bind_named(":previous_revision", i64::from(revision - 1)),
    }.bind_named(":site", site.clone())
     .bind_named(":title", title.clone())
     .bind_named(":observation", observation.clone());

    state.pending_note = Some(PendingFieldNote { target_id, site, title, observation, revision });
    state.is_saving = true;
    state.has_error = false;
    state.validation_error = false;
    state.notice = "notes.notice.saving".into();
    let stored = ctx.effects.bind(FieldNoteStored, reduce!(field_note_stored));
    let failed = ctx.effects.bind(FieldNotesStorageFailed, reduce!(field_notes_storage_failed));
    ctx.effects.sql().execute(statement).on_ok(stored).on_err(failed);
}

#[fission_reducer(FieldNoteStored)]
pub fn field_note_stored(state: &mut FieldNotesState, ctx: &mut ReducerContext<FieldNotesState>) {
    let Some(result) = ctx.input.sql_execute_result() else {
        field_notes_storage_failed(state, FieldNotesStorageFailed, ctx);
        return;
    };
    if result.affected_rows != 1 {
        state.is_saving = false;
        state.has_error = true;
        state.requires_reload = true;
        state.notice = "notes.notice.newer_revision".into();
        return;
    }
    let Some(pending) = state.pending_note.take() else { return; };
    let Some(id) = pending.target_id.or(result.last_insert_rowid) else {
        state.pending_note = Some(pending);
        field_notes_storage_failed(state, FieldNotesStorageFailed, ctx);
        return;
    };
    let note = FieldNote {
        id, site: pending.site, title: pending.title, observation: pending.observation,
        revision: pending.revision, updated_at: String::new(),
        sync_status: NoteSyncStatus::WaitingToSync,
    };
    if pending.target_id.is_none() {
        state.notes.insert(0, note);
    } else if let Some(current) = state.notes.iter_mut().find(|note| note.id == id) {
        *current = note;
    } else {
        state.requires_reload = true;
        state.has_error = true;
        state.notice = "notes.notice.saved_not_visible".into();
        state.is_saving = false;
        return;
    }
    state.selected_note_id = Some(id);
    state.site_draft.clear();
    state.title_draft.clear();
    state.observation_draft.clear();
    state.is_editing = false;
    state.is_new_note = false;
    state.is_saving = false;
    state.has_error = false;
    state.validation_error = false;
    state.notice = "notes.notice.saved_on_device".into();
    state.is_loading = true;
    load_field_notes(state, LoadFieldNotes, ctx);
}

#[fission_reducer(SyncNoteSucceeded)]
pub fn on_sync_note_succeeded(
    state: &mut FieldNotesState,
    note_id: i64,
    sent_revision: u32,
    ctx: &mut ReducerContext<FieldNotesState>,
) {
    if state.is_saving || state.is_loading || state.requires_reload {
        return;
    }
    let Some(note) = state.notes.iter().find(|note| note.id == note_id) else {
        return;
    };

    if note.revision != sent_revision {
        return;
    }

    let statement = SqlStatement::new(
        "UPDATE field_notes
         SET sync_status = 'synced'
         WHERE id = :id AND revision = :revision",
    )
    .bind_named(":id", note_id)
    .bind_named(":revision", i64::from(sent_revision));

    let stored = ctx.effects.bind(FieldNoteSyncStatusStored(note_id, sent_revision), reduce!(field_note_sync_status_stored));
    let failed = ctx.effects.bind(FieldNotesStorageFailed, reduce!(field_notes_storage_failed));
    state.is_saving = true;
    ctx.effects.sql().execute(statement).on_ok(stored).on_err(failed);
}

#[fission_reducer(FieldNoteSyncStatusStored)]
pub fn field_note_sync_status_stored(
    state: &mut FieldNotesState,
    note_id: i64,
    sent_revision: u32,
    ctx: &mut ReducerContext<FieldNotesState>,
) {
    state.is_saving = false;
    let Some(result) = ctx.input.sql_execute_result() else {
        field_notes_storage_failed(state, FieldNotesStorageFailed, ctx);
        return;
    };
    if result.affected_rows != 1 {
        state.has_error = true;
        state.validation_error = false;
        state.requires_reload = true;
        state.notice = "notes.notice.newer_revision".into();
        return;
    }
    let Some(note) = state.notes.iter_mut().find(|note| note.id == note_id) else {
        state.has_error = true;
        state.validation_error = false;
        state.requires_reload = true;
        state.notice = "notes.notice.saved_not_visible".into();
        return;
    };
    if note.revision != sent_revision {
        state.has_error = true;
        state.validation_error = false;
        state.requires_reload = true;
        state.notice = "notes.notice.newer_revision".into();
        return;
    }
    note.sync_status = NoteSyncStatus::Synced;
}
{"id":"fission-tabs-1","index":9,"label":"src/lib.rs","value":"src-lib-rs"}
mod models;
mod state;
mod storage;
mod widgets;
mod app;
mod translations;
use fission::prelude::*;
#[cfg(not(any(target_arch = "wasm32", target_os = "android", target_os = "ios")))]
pub fn run_desktop() -> anyhow::Result<()> {
    DesktopApp::<state::FieldNotesState, _>::new(app::FieldNotesWorkspace::new())
        .with_env(translations::create_env()).with_title("Harbour Field Notes")
        .with_startup_action(storage::PrepareFieldNotes).run()
}
#[cfg(any(target_os = "android", target_os = "ios"))]
fn mobile_app() -> MobileApp<state::FieldNotesState, app::FieldNotesWorkspace> {
    MobileApp::new(app::FieldNotesWorkspace::new())
        .with_env(translations::create_env()).with_title("Harbour Field Notes")
        .with_startup_action(storage::PrepareFieldNotes)
}
#[cfg(any(target_os = "android", target_os = "ios"))]
pub fn run_mobile() -> anyhow::Result<()> { mobile_app().run() }
#[cfg(target_os = "android")]
#[no_mangle]
fn android_main(app_handle: AndroidApp) { let _ = mobile_app().run_with_android_app(app_handle); }
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn run_web() -> Result<(), wasm_bindgen::JsValue> {
    WebApp::<state::FieldNotesState, _>::new(app::FieldNotesWorkspace::new())
        .with_env(translations::create_env()).with_title("Harbour Field Notes")
        .with_startup_action(storage::PrepareFieldNotes).run()
        .map_err(|error| wasm_bindgen::JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":10,"label":"preview/lib.rs","value":"preview-lib-rs"}
mod models;
mod state;
mod storage;
mod widgets;
mod app;
mod translations;
use fission::prelude::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(start)]
pub fn run() -> Result<(), JsValue> {
    console_error_panic_hook::set_once();
    WebApp::<state::FieldNotesState, _>::new(app::FieldNotesWorkspace::new())
        .with_env(translations::create_env()).with_title("Harbour Field Notes")
        .with_startup_action(storage::PrepareFieldNotes)
        .mount("#fission-web-mount").run()
        .map_err(|error| JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1"}
The final preview and native app both bind Save on this device to the real SaveFieldNoteToSqlite reducer. It validates and snapshots the draft, disables editing during the write, and updates the visible note only after FieldNoteStored confirms the commit. The SQLite effect runs outside the reducer, so it doesn’t block a frame. On an uncertain failure, FieldNotesStorageFailed keeps the draft visible and blocks another write. The explicit reload action discards that draft and reads the database before allowing new work; it does not silently replay an insert that may already have committed. This tutorial does not send a sync request. When you add a network effect, send the note ID and revision and bind SyncNoteSucceeded to its reducer before dispatching it after the service confirms that revision. The reducers check that revision before the local status write, in the SQL WHERE clause, and again before updating the visible note. That status write shares the same busy guard as manual saves and loading. A missing result, unexpected row count or missing acknowledged record requires reload rather than silently releasing another operation's guard or marking the note synced.
The busy guard returns immediately; it does not queue a server acknowledgement for later. If an acknowledgement arrives while a save or load is in flight, the note remains waiting to sync. A future service integration must retry or reconcile that same note ID and revision under an idempotent server contract. It must not assume this reducer retained the acknowledgement or apply it to a newer revision. No service or acknowledgement queue is implemented here.
Test the boundary deliberately: store revision 5, edit and store revision 6, then dispatch the SyncNoteSucceeded completion for revision 5. The visible text must stay at revision 6 and remain waiting to sync. Also test an empty database, a failed local write, and a process restart with a pending revision. A successful remote sync requires a real service effect, which is outside this tutorial.

Run the shared app on Android and iOS

The final source includes normal src/lib.rs target launchers. The workspace binds migration unconditionally; each storage request binds its completion reducers. The startup action queues migration and then loading. The final Web preview follows that same SQLite path and contains no sample records.
Run the target commands from the project root. fission doctor checks the installed toolchains, and fission test verifies that each generated host can launch the shared app.
{"id":"fission-tabs-2","tabs":[{"index":0,"label":"Android","value":"android"},{"index":1,"label":"iOS","value":"ios"}]}
{"id":"fission-tabs-2","index":0,"label":"Android","value":"android"}
fission doctor android --project-dir .
fission run --target android --project-dir .
fission test --target android --project-dir .
fission build --target android --project-dir . --release
{"id":"fission-tabs-2","index":1,"label":"iOS","value":"ios"}
fission doctor ios --project-dir .
fission run --target ios --project-dir .
fission test --target ios --project-dir .
fission build --target ios --project-dir . --release
{"id":"fission-tabs-2"}
Use the storage and SQLite guide for provider setup, parameterized statements, transactions, and migrations. The state and effects guide explains why reducers describe transitions while effects perform storage and network work. The component reference covers the Fission components used to compose the field-notes screen.