s_usedIdentifiers = new();
+
+ ///
+ /// Generates a unique script identifier using a GUID.
+ ///
+ /// A unique identifier in format "script_{guid}"
+ /// Thrown if a duplicate identifier is detected.
+ public static string GenerateScriptId()
+ {
+ string scriptId = $"script_{Guid.NewGuid():N}";
+ if (!s_usedIdentifiers.Add(scriptId))
+ throw new InvalidOperationException($"Script identifier {scriptId} is already in use!");
+ return scriptId;
+ }
+
+ ///
+ /// Removes a script identifier from tracking when it's no longer needed.
+ ///
+ /// The script identifier to remove.
+ public static void ClearIdentifier(string scriptId)
+ {
+ s_usedIdentifiers.Remove(scriptId);
+ }
+}
diff --git a/src/Lumina.Presentation.Web/Views/Auth/ChangePassword.cshtml b/src/Lumina.Presentation.Web/Views/Auth/ChangePassword.cshtml
index ebae7dcd..3c71fa20 100644
--- a/src/Lumina.Presentation.Web/Views/Auth/ChangePassword.cshtml
+++ b/src/Lumina.Presentation.Web/Views/Auth/ChangePassword.cshtml
@@ -7,6 +7,11 @@
@inject IUrlService _urlService
+@{
+ // generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
+ var scriptId = ScriptIdentifierHelper.GenerateScriptId();
+}
+
@model ChangePasswordRequestModel
@@ -59,7 +64,7 @@
@section Scripts {
-
}
diff --git a/src/Lumina.Presentation.Web/Views/Library/Management/Item.cshtml b/src/Lumina.Presentation.Web/Views/Library/Management/Item.cshtml
index be4ef6cb..1af0a4bd 100644
--- a/src/Lumina.Presentation.Web/Views/Library/Management/Item.cshtml
+++ b/src/Lumina.Presentation.Web/Views/Library/Management/Item.cshtml
@@ -3,9 +3,12 @@
*@
@using Lumina.Presentation.Web.Common.Models.Libraries
+@using Lumina.Presentation.Web.Common.Services
@{
var id = Context.Request.RouteValues["id"] as string;
+ // generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
+ var scriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@model LibraryModel
@@ -84,7 +87,8 @@
@section Scripts {
-
- @await RenderSectionAsync("Scripts", required: false)
+
+ @await RenderSectionAsync("Scripts", required: false)
+