From 8070129bcad79d976d719b053d2932935404a0d0 Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 18 Feb 2026 07:40:45 -0600 Subject: [PATCH] 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. --- plugin/src/ChangeBatcher/encodeService.lua | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/plugin/src/ChangeBatcher/encodeService.lua b/plugin/src/ChangeBatcher/encodeService.lua index 981269f2..66308cd4 100644 --- a/plugin/src/ChangeBatcher/encodeService.lua +++ b/plugin/src/ChangeBatcher/encodeService.lua @@ -90,12 +90,23 @@ return function(service: Instance) end end - return { + local result = { className = service.ClassName, 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