From 44041f33e36dfd0a01858fbfa0aa50ac7131140e Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Fri, 14 Feb 2020 18:29:43 -0800 Subject: [PATCH] Start trying to sync parenting-to-nil (deleting) --- plugin/src/ServeSession.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugin/src/ServeSession.lua b/plugin/src/ServeSession.lua index 41580f66..b13b351e 100644 --- a/plugin/src/ServeSession.lua +++ b/plugin/src/ServeSession.lua @@ -120,6 +120,8 @@ function ServeSession:__onInstanceChanged(instance, propertyName) return end + local remove = nil + local update = { id = instanceId, changedProperties = {}, @@ -127,6 +129,14 @@ function ServeSession:__onInstanceChanged(instance, propertyName) if propertyName == "Name" then update.changedName = instance.Name + elseif propertyName == "Parent" then + if instance.Parent == nil then + update = nil + remove = instanceId + else + Log.warn("Cannot sync non-nil Parent property changes yet") + return + end else local success, encoded = self.__reconciler:encodeApiValue(instance[propertyName]) @@ -139,7 +149,7 @@ function ServeSession:__onInstanceChanged(instance, propertyName) end local patch = { - removed = {}, + removed = {remove}, added = {}, updated = {update}, }