fix(data-store): exclude for_type/for_id from PATCH payload
for_id is an integer FK in the DB but the frontend passes the random string ID — sending it on update causes a 400. These fields are parent-context set at creation time and should never change on edit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -278,8 +278,13 @@ async function handle_submit_form(event: Event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const api_cfg = untrack(() => $ae_api);
|
const api_cfg = untrack(() => $ae_api);
|
||||||
const api_call = $lq__ds_obj?.id
|
// for_type and for_id are parent-context fields set at creation time; never send them on update
|
||||||
? api.update_ae_obj({ api_cfg, obj_type: 'data_store', obj_id: $lq__ds_obj.id, fields: data_store_do })
|
// (for_id is an integer FK in the DB — sending a string random ID causes a 400 error).
|
||||||
|
const update_do: key_val = { ...data_store_do };
|
||||||
|
delete update_do.for_type;
|
||||||
|
delete update_do.for_id;
|
||||||
|
const api_call = $lq__ds_obj?.id
|
||||||
|
? api.update_ae_obj({ api_cfg, obj_type: 'data_store', obj_id: $lq__ds_obj.id, fields: update_do })
|
||||||
: api.create_ae_obj({ api_cfg, obj_type: 'data_store', fields: data_store_do });
|
: api.create_ae_obj({ api_cfg, obj_type: 'data_store', fields: data_store_do });
|
||||||
|
|
||||||
api_call.then((res) => {
|
api_call.then((res) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user