Branch : feat/state_management
Problem
the porblem is that current implmentaiton of the load_states function from the persistency module in rust does the following
Situation 1
the app schema is newer than the stored schema.
when app first lauches:
- frontend calls the tauri command
get_persistent_states() on mount (using onMount from svelte)
get_persistent_states() calls the load_state() funtion
load_state() reads the file config.json
- app schema is newer than
config.json schema (just the structure)
- returns an Err immediately without even reaching the migration. expected behaviour was for it to run migrate old schema to app;s schema because that's when migration should run
Situation 2
the app schema is older than stored schema.
when the first lauches:
- frontend calls the tauri command
get_persistent_states() on mount (using onMount from svelte)
get_persistent_states() calls the load_state() funtion
load_state() reads the file config.json
- app schema is older than
config.json schema (just the structure)
- returns an Err immediately. expected behaviour was for it to use default config values
Situation 3
the app schema is same as the stored schema.
this initially works but breaks when the schema_version field in config.json is incorrectly set higher than the app schema. if that happens then on app lauch :
- frontend calls the tauri command
get_persistent_states() on mount (using onMount from svelte)
get_persistent_states() calls the load_state() funtion
load_state() reads the file config.json
- app schema is same as the
config.json schema (just the structure)
- check if the schema_version is equal to the app schema version (which is just a number)
- runs migrations when it shouldn't have becuase the schema structure was already set to the app schema but with incorrectly higher schema_version
Branch :
feat/state_managementProblem
the porblem is that current implmentaiton of the
load_statesfunction from thepersistencymodule in rust does the followingSituation 1
the app schema is newer than the stored schema.
when app first lauches:
get_persistent_states()on mount (using onMount from svelte)get_persistent_states()calls theload_state()funtionload_state()reads the fileconfig.jsonconfig.jsonschema (just the structure)Situation 2
the app schema is older than stored schema.
when the first lauches:
get_persistent_states()on mount (using onMount from svelte)get_persistent_states()calls theload_state()funtionload_state()reads the fileconfig.jsonconfig.jsonschema (just the structure)Situation 3
the app schema is same as the stored schema.
this initially works but breaks when the schema_version field in
config.jsonis incorrectly set higher than the app schema. if that happens then on app lauch :get_persistent_states()on mount (using onMount from svelte)get_persistent_states()calls theload_state()funtionload_state()reads the fileconfig.jsonconfig.jsonschema (just the structure)