Enhance PatchSet data model update handling and update default project path in CLI

- Improved the `removeDataModelName` function in PatchSet to remove names from both `changedName` and `changedProperties`, ensuring more robust update management.
- Updated the default project path in the ServeCommand struct to `default.project.json5` for clearer project serving expectations.
This commit is contained in:
Joe 2026-01-30 11:35:49 -06:00
parent 77088eccd8
commit a98d5c6cce
2 changed files with 21 additions and 6 deletions

View file

@ -407,13 +407,28 @@ function PatchSet.removeDataModelName(patchSet, instanceMap)
end end
for i, update in ipairs(patchSet.updated) do for i, update in ipairs(patchSet.updated) do
if update.id == dataModelId and update.changedName ~= nil then if update.id == dataModelId then
update.changedName = nil -- Remove Name from both changedName and changedProperties
local hadChanges = false
if update.changedName ~= nil then
update.changedName = nil
hadChanges = true
end
if update.changedProperties and update.changedProperties.Name ~= nil then
update.changedProperties.Name = nil
hadChanges = true
end
if not hadChanges then
return
end
-- Remove update entirely if no other changes remain -- Remove update entirely if no other changes remain
if if
update.changedClassName == nil update.changedName == nil
and update.changedClassName == nil
and update.changedMetadata == nil and update.changedMetadata == nil
and next(update.changedProperties) == nil and (update.changedProperties == nil or next(update.changedProperties) == nil)
then then
table.remove(patchSet.updated, i) table.remove(patchSet.updated, i)
end end

View file

@ -19,8 +19,8 @@ const DEFAULT_PORT: u16 = 34872;
/// Expose a Rojo project to the Rojo Studio plugin. /// Expose a Rojo project to the Rojo Studio plugin.
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
pub struct ServeCommand { pub struct ServeCommand {
/// Path to the project to serve. Defaults to the current directory. /// Path to the project to serve. Defaults to `default.project.json5`.
#[clap(default_value = "")] #[clap(default_value = "default.project.json5")]
pub project: PathBuf, pub project: PathBuf,
/// The IP address to listen on. Defaults to `127.0.0.1`. /// The IP address to listen on. Defaults to `127.0.0.1`.