diff --git a/CHANGELOG.md b/CHANGELOG.md index fcc7edbf..b7892885 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Roact Changelog ## Unreleased Changes +* Remove trimming from tracing ([#387](https://github.com/Roblox/roact/pull/387)) ## [1.4.4](https://github.com/Roblox/roact/releases/tag/v1.4.4) (June 13th, 2022) * Added Luau analysis to the repository ([#372](https://github.com/Roblox/roact/pull/372)) diff --git a/src/Logging.lua b/src/Logging.lua index 13f7190e..544b150d 100644 --- a/src/Logging.lua +++ b/src/Logging.lua @@ -129,8 +129,8 @@ function Logging.warn(messageTemplate, ...) table.insert(collector.warnings, message) end - -- debug.traceback inserts a leading newline, so we trim it here - local trace = debug.traceback("", 2):sub(2) + -- Set message to nil so a newline doesn't get added. + local trace = debug.traceback(nil, 2) local fullMessage = ("%s\n%s"):format(message, indent(trace, 1)) if outputEnabled then diff --git a/src/createElement.lua b/src/createElement.lua index 4fd6fe5a..45827b1a 100644 --- a/src/createElement.lua +++ b/src/createElement.lua @@ -63,9 +63,8 @@ local function createElement(component, props, children) } if config.elementTracing then - -- We trim out the leading newline since there's no way to specify the - -- trace level without also specifying a message. - element.source = debug.traceback("", 2):sub(2) + -- We set the message to nil to prevent the newline from appearing. + element.source = debug.traceback(nil, 2) end return element