fix(ux): reset input history on plugin dispose (F10.1)
Static InputHistoryService entries used to survive a plugin reload because static field state doesn't get cleaned up on its own. The new Reset() method clears the list and is wired into Plugin.DisposeAsync alongside the existing pure-memory cleanups, so the next plugin load starts with an empty history instead of inheriting the previous session's typed commands.
This commit is contained in:
@@ -41,4 +41,12 @@ public static class InputHistoryService
|
|||||||
return null;
|
return null;
|
||||||
return _entries[cursor];
|
return _entries[cursor];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Plugin reload doesn't reset static state automatically. Plugin.DisposeAsync
|
||||||
|
// calls this so the next load starts with an empty history instead of
|
||||||
|
// inheriting the previous session's entries.
|
||||||
|
public static void Reset()
|
||||||
|
{
|
||||||
|
_entries.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,6 +372,8 @@ public sealed class Plugin : IAsyncDalamudPlugin
|
|||||||
failure = CaptureFailure(failure, () => Functions?.Dispose());
|
failure = CaptureFailure(failure, () => Functions?.Dispose());
|
||||||
failure = CaptureFailure(failure, () => Commands?.Dispose());
|
failure = CaptureFailure(failure, () => Commands?.Dispose());
|
||||||
failure = CaptureFailure(failure, () => EmoteCache.Dispose());
|
failure = CaptureFailure(failure, () => EmoteCache.Dispose());
|
||||||
|
// Static input history would otherwise survive the plugin reload.
|
||||||
|
failure = CaptureFailure(failure, InputHistoryService.Reset);
|
||||||
|
|
||||||
if (failure is not null)
|
if (failure is not null)
|
||||||
ExceptionDispatchInfo.Capture(failure).Throw();
|
ExceptionDispatchInfo.Capture(failure).Throw();
|
||||||
|
|||||||
Reference in New Issue
Block a user