diff --git a/.github/workflows/clabot.yml b/.github/workflows/clabot.yml deleted file mode 100644 index 133585f..0000000 --- a/.github/workflows/clabot.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: "CLA Signature Bot" -on: - issue_comment: - types: [created] - pull_request: - types: [opened,closed,synchronize] - -jobs: - clabot: - runs-on: ubuntu-latest - steps: - - name: "CLA Signature Bot" - uses: roblox/cla-signature-bot@v2.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - whitelist: "LPGhatguy,ZoteTheMighty,cliffchapmanrbx,MisterUncloaked,matthargett" - use-remote-repo: true - remote-repo-name: "roblox/cla-bot-store" - remote-repo-pat: ${{ secrets.CLA_REMOTE_REPO_PAT }} - url-to-cladocument: "https://roblox.github.io/cla-bot-store/" diff --git a/CHANGELOG.md b/CHANGELOG.md index 04f3b32..cb145ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased Changes +## 3.3.0 (2024-11-19) +* Add flag around change to only call traceback() in connection listeners in `__DEV__` ([#98](https://github.com/Roblox/rodux/pull/98)) +* Only call traceback() in connection listeners in `__DEV__` ([#78](https://github.com/Roblox/rodux/pull/78)) + ## 3.2.0 (2023-11-17) * Add makeThunkMiddleware to inject custom argument ([#94](https://github.com/Roblox/rodux/pull/94)). diff --git a/rotriever.toml b/rotriever.toml index 06db746..2c7e05c 100644 --- a/rotriever.toml +++ b/rotriever.toml @@ -3,4 +3,4 @@ name = "Rodux" authors = ["Roblox"] license = "Apache-2.0" content_root = "src" -version = "3.2.0" +version = "3.3.0" diff --git a/src/Signal.lua b/src/Signal.lua index 04c71dc..e3c9b7d 100644 --- a/src/Signal.lua +++ b/src/Signal.lua @@ -4,6 +4,14 @@ Handlers are fired in order, and (dis)connections are properly handled when executing an event. ]] +local __DEV__ = _G.__DEV__ + +local _, FFlagRoduxRemoveConnectTraceback = xpcall(function() + return game:DefineFastFlag("RoduxRemoveConnectTraceback", false) +end, function() + return true +end) + local function immutableAppend(list, ...) local new = {} local len = #list @@ -38,7 +46,7 @@ Signal.__index = Signal function Signal.new(store) local self = { _listeners = {}, - _store = store + _store = store, } setmetatable(self, Signal) @@ -53,43 +61,48 @@ function Signal:connect(callback) if self._store and self._store._isDispatching then error( - 'You may not call store.changed:connect() while the reducer is executing. ' .. - 'If you would like to be notified after the store has been updated, subscribe from a ' .. - 'component and invoke store:getState() in the callback to access the latest state. ' + "You may not call store.changed:connect() while the reducer is executing. " + .. "If you would like to be notified after the store has been updated, subscribe from a " + .. "component and invoke store:getState() in the callback to access the latest state. " ) end local listener = { callback = callback, disconnected = false, - connectTraceback = debug.traceback(), - disconnectTraceback = nil + connectTraceback = nil, + disconnectTraceback = nil, } + if not FFlagRoduxRemoveConnectTraceback or __DEV__ then + listener.connectTraceback = debug.traceback() + end + self._listeners = immutableAppend(self._listeners, listener) local function disconnect() if listener.disconnected then - error(( - "Listener connected at: \n%s\n" .. - "was already disconnected at: \n%s\n" - ):format( - tostring(listener.connectTraceback), - tostring(listener.disconnectTraceback) - )) + error( + ("Listener connected at: \n%s\n" .. "was already disconnected at: \n%s\n"):format( + tostring(listener.connectTraceback), + tostring(listener.disconnectTraceback) + ) + ) end if self._store and self._store._isDispatching then error("You may not unsubscribe from a store listener while the reducer is executing.") end + if not FFlagRoduxRemoveConnectTraceback or __DEV__ then + listener.disconnectTraceback = debug.traceback() + end listener.disconnected = true - listener.disconnectTraceback = debug.traceback() self._listeners = immutableRemoveValue(self._listeners, listener) end return { - disconnect = disconnect + disconnect = disconnect, } end @@ -101,4 +114,4 @@ function Signal:fire(...) end end -return Signal \ No newline at end of file +return Signal