diff --git a/plugin/src/Reconciler/applyPatch.spec.lua b/plugin/src/Reconciler/applyPatch.spec.lua index 28e2a41e..2432359f 100644 --- a/plugin/src/Reconciler/applyPatch.spec.lua +++ b/plugin/src/Reconciler/applyPatch.spec.lua @@ -146,8 +146,7 @@ return function() id = "VALUE", changedProperties = { Value = { - Type = "String", - Value = "WORLD", + String = "WORLD", }, }, }) @@ -176,8 +175,7 @@ return function() changedClassName = "StringValue", changedProperties = { Value = { - Type = "String", - Value = "I am Root", + String = "I am Root", }, }, }) diff --git a/plugin/src/Reconciler/decodeValue.lua b/plugin/src/Reconciler/decodeValue.lua index 5962d210..321aae92 100644 --- a/plugin/src/Reconciler/decodeValue.lua +++ b/plugin/src/Reconciler/decodeValue.lua @@ -6,29 +6,31 @@ local RbxDom = require(script.Parent.Parent.Parent.RbxDom) local Error = require(script.Parent.Error) -local function decodeValue(virtualValue, instanceMap) +local function decodeValue(encodedValue, instanceMap) + local ty, value = next(encodedValue) + -- Refs are represented as IDs in the same space that Rojo's protocol uses. - if virtualValue.Type == "Ref" then - if virtualValue.Value == nil then + if ty == "Ref" then + if value == nil then return true, nil end - local instance = instanceMap.fromIds[virtualValue.Value] + local instance = instanceMap.fromIds[value] if instance ~= nil then return true, instance else return false, Error.new(Error.RefDidNotExist, { - virtualValue = virtualValue, + encodedValue = encodedValue, }) end end - local ok, decodedValue = RbxDom.EncodedValue.decode(virtualValue) + local ok, decodedValue = RbxDom.EncodedValue.decode(encodedValue) if not ok then return false, Error.new(Error.CannotDecodeValue, { - virtualValue = virtualValue, + encodedValue = encodedValue, innerError = decodedValue, }) end diff --git a/plugin/src/Reconciler/diff.spec.lua b/plugin/src/Reconciler/diff.spec.lua index 47709554..7618eea9 100644 --- a/plugin/src/Reconciler/diff.spec.lua +++ b/plugin/src/Reconciler/diff.spec.lua @@ -80,8 +80,7 @@ return function() Name = "Value", Properties = { Value = { - Type = "String", - Value = "Hello, world!", + String = "Hello, world!", }, }, Children = {}, @@ -107,8 +106,9 @@ return function() local patchProperty = update.changedProperties["Value"] expect(patchProperty).to.be.a("table") - expect(patchProperty.Type).to.equal("String") - expect(patchProperty.Value).to.equal("Hello, world!") + local ty, value = next(patchProperty) + expect(ty).to.equal("String") + expect(value).to.equal("Hello, world!") end) it("should generate an empty patch if no properties changed", function() @@ -119,8 +119,7 @@ return function() Name = "Value", Properties = { Value = { - Type = "String", - Value = "Hello, world!", + String = "Hello, world!", }, }, Children = {}, @@ -145,8 +144,7 @@ return function() Name = "Folder", Properties = { FAKE_PROPERTY = { - Type = "String", - Value = "Hello, world!", + String = "Hello, world!", }, }, Children = {}, @@ -183,8 +181,7 @@ return function() -- heat_xml is a serialization-only property that is not -- exposed to Lua. heat_xml = { - Type = "Float32", - Value = 5, + Float32 = 5, }, }, Children = {}, diff --git a/plugin/src/Reconciler/reify.spec.lua b/plugin/src/Reconciler/reify.spec.lua index 74335ec5..9097da5d 100644 --- a/plugin/src/Reconciler/reify.spec.lua +++ b/plugin/src/Reconciler/reify.spec.lua @@ -54,8 +54,7 @@ return function() Name = "Spaghetti", Properties = { Value = { - Type = "String", - Value = "Hello, world!", + String = "Hello, world!", }, }, Children = {},