Refactor service encoding to conditionally include properties, attributes, tags, and references

- Updated the `encodeService` function to return a more concise result object by conditionally including properties, attributes, tags, and references only if they are present.
- This change enhances the efficiency of the encoding process by reducing unnecessary data in the output, improving overall performance during syncback operations.
This commit is contained in:
Joe 2026-02-18 07:40:45 -06:00
parent c3cb9b4b98
commit 8070129bca

View file

@ -90,12 +90,23 @@ return function(service: Instance)
end end
end end
return { local result = {
className = service.ClassName, className = service.ClassName,
data = data, data = data,
properties = properties,
attributes = attributes,
tags = tags,
refs = refs,
} }
if next(properties) then
result.properties = properties
end
if next(attributes) then
result.attributes = attributes
end
if #tags > 0 then
result.tags = tags
end
if next(refs) then
result.refs = refs
end
return result
end end