mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 21:41:37 +00:00
Add patch application state management in ServeSession
- Introduced a new flag `__applyingPatch` to track the patch application state, preventing `DescendantAdded` events during reconciliation. - Updated the `__applyPatch` method to set and clear the `__applyingPatch` flag appropriately, enhancing control over script updates. - Added checks in the `__connectScriptsOnlyWatchers` method to avoid processing during patch application. These changes aim to improve the reliability of script handling during patch operations and prevent unintended side effects.
This commit is contained in:
parent
75727171ef
commit
a68e0ab7c6
1 changed files with 7 additions and 0 deletions
|
|
@ -124,6 +124,7 @@ function ServeSession.new(options)
|
||||||
__serverInfo = nil,
|
__serverInfo = nil,
|
||||||
__confirmingPatch = nil,
|
__confirmingPatch = nil,
|
||||||
__isConfirming = false, -- Explicit confirmation state flag for defense-in-depth
|
__isConfirming = false, -- Explicit confirmation state flag for defense-in-depth
|
||||||
|
__applyingPatch = false, -- Set during reconciler patch application to suppress DescendantAdded
|
||||||
__connections = connections,
|
__connections = connections,
|
||||||
__precommitCallbacks = {},
|
__precommitCallbacks = {},
|
||||||
__postcommitCallbacks = {},
|
__postcommitCallbacks = {},
|
||||||
|
|
@ -561,8 +562,10 @@ function ServeSession:__applyPatch(patch)
|
||||||
end
|
end
|
||||||
Timer.stop()
|
Timer.stop()
|
||||||
|
|
||||||
|
self.__applyingPatch = true
|
||||||
local patchApplySuccess, unappliedPatch = pcall(self.__reconciler.applyPatch, self.__reconciler, patch)
|
local patchApplySuccess, unappliedPatch = pcall(self.__reconciler.applyPatch, self.__reconciler, patch)
|
||||||
if not patchApplySuccess then
|
if not patchApplySuccess then
|
||||||
|
self.__applyingPatch = false
|
||||||
if historyRecording then
|
if historyRecording then
|
||||||
ChangeHistoryService:FinishRecording(historyRecording, Enum.FinishRecordingOperation.Commit)
|
ChangeHistoryService:FinishRecording(historyRecording, Enum.FinishRecordingOperation.Commit)
|
||||||
end
|
end
|
||||||
|
|
@ -596,6 +599,7 @@ function ServeSession:__applyPatch(patch)
|
||||||
PatchSet.assign(unappliedPatch, unappliedUpdateRefs)
|
PatchSet.assign(unappliedPatch, unappliedUpdateRefs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
self.__applyingPatch = false
|
||||||
|
|
||||||
if not PatchSet.isEmpty(unappliedPatch) then
|
if not PatchSet.isEmpty(unappliedPatch) then
|
||||||
Log.info(
|
Log.info(
|
||||||
|
|
@ -939,6 +943,9 @@ function ServeSession:__connectScriptsOnlyWatchers()
|
||||||
if self.__changeBatcher:isPaused() then
|
if self.__changeBatcher:isPaused() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if self.__applyingPatch then
|
||||||
|
return
|
||||||
|
end
|
||||||
if not descendant:IsA("LuaSourceContainer") then
|
if not descendant:IsA("LuaSourceContainer") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue