fix(frontend): fix newly deployed apps with frontend scripts

This commit is contained in:
Ruben Fiszel
2024-12-10 19:37:00 +01:00
parent 7ab42de977
commit bcd2cfe674
3 changed files with 10 additions and 0 deletions
@@ -0,0 +1 @@
-- Add down migration script here
@@ -0,0 +1,2 @@
-- Add up migration script here
delete from app_version_lite;
@@ -1243,6 +1243,13 @@ async fn reduce_app(db: &sqlx::Pool<sqlx::Postgres>, value: &mut Value, app: i64
match value {
Value::Object(object) => {
if let Some(Value::Object(script)) = object.get_mut("inlineScript") {
if script
.get("language")
.and_then(|x| x.as_str())
.is_some_and(|x| x == "frontend")
{
return Ok(());
}
// replace `content` with an empty string:
let Some(Value::String(code)) = script.get_mut("content").map(std::mem::take)
else {