mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-23 22:25:26 +00:00
Remove instanceMetadataMap from plugin
This commit is contained in:
@@ -100,10 +100,9 @@ end
|
|||||||
local Reconciler = {}
|
local Reconciler = {}
|
||||||
Reconciler.__index = Reconciler
|
Reconciler.__index = Reconciler
|
||||||
|
|
||||||
function Reconciler.new(instanceMetadataMap)
|
function Reconciler.new()
|
||||||
local self = {
|
local self = {
|
||||||
instanceMap = makeInstanceMap(),
|
instanceMap = makeInstanceMap(),
|
||||||
instanceMetadataMap = instanceMetadataMap,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return setmetatable(self, Reconciler)
|
return setmetatable(self, Reconciler)
|
||||||
@@ -176,7 +175,7 @@ function Reconciler:reconcile(virtualInstancesById, id, instance)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self:__shouldClearUnknownInstances(id) then
|
if self:__shouldClearUnknownInstances(virtualInstance) then
|
||||||
for existingChildInstance in pairs(unvisitedExistingChildren) do
|
for existingChildInstance in pairs(unvisitedExistingChildren) do
|
||||||
self.instanceMap:removeInstance(existingChildInstance)
|
self.instanceMap:removeInstance(existingChildInstance)
|
||||||
existingChildInstance:Destroy()
|
existingChildInstance:Destroy()
|
||||||
@@ -204,9 +203,9 @@ function Reconciler:reconcile(virtualInstancesById, id, instance)
|
|||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
|
|
||||||
function Reconciler:__shouldClearUnknownInstances(id)
|
function Reconciler:__shouldClearUnknownInstances(virtualInstance)
|
||||||
if self.instanceMetadataMap[id] then
|
if virtualInstance.Metadata ~= nil then
|
||||||
return not self.instanceMetadataMap[id].ignoreUnknownInstances
|
return not virtualInstance.Metadata.ignoreUnknownInstances
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ function Session.new(config)
|
|||||||
local self = {
|
local self = {
|
||||||
onError = config.onError,
|
onError = config.onError,
|
||||||
disconnected = false,
|
disconnected = false,
|
||||||
reconciler = nil,
|
reconciler = Reconciler.new(),
|
||||||
api = api,
|
api = api,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,8 +25,6 @@ function Session.new(config)
|
|||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
end
|
end
|
||||||
|
|
||||||
self.reconciler = Reconciler.new(api.instanceMetadataMap)
|
|
||||||
|
|
||||||
return api:read({api.rootInstanceId})
|
return api:read({api.rootInstanceId})
|
||||||
:andThen(function(response)
|
:andThen(function(response)
|
||||||
if self.disconnected then
|
if self.disconnected then
|
||||||
|
|||||||
Reference in New Issue
Block a user