avoid race condition issue.

This commit is contained in:
Ben 2024-07-03 17:07:47 +08:00
parent 2bacee919d
commit 599071b68b

View File

@ -244,8 +244,9 @@
if (_allowRichText)
{
if (_settingsLoaded && !_initialized)
if (firstRender)
{
await LoadSettings();
await interop.CreateEditor(
_editorElement,
_toolBar,
@ -444,6 +445,8 @@
private async Task LoadSettings()
{
try
{
if (!_settingsLoaded)
{
var settings = await SettingService.GetSiteSettingsAsync(PageState.Site.SiteId);
_allowFileManagementSetting = _allowFileManagement = SettingService.GetSetting(settings, "QuillTextEditor_AllowFileManagement", "true") == "true";
@ -457,6 +460,7 @@
_settingsLoaded = true;
}
}
catch (Exception ex)
{
AddModuleMessage(ex.Message, MessageType.Error);
@ -476,7 +480,7 @@
settings = SettingService.SetSetting(settings, "QuillTextEditor_ToolbarContent", _toolbarContentSetting);
await SettingService.UpdateSiteSettingsAsync(settings, PageState.Site.SiteId);
NavigationManager.NavigateTo(NavigationManager.Uri);
NavigationManager.NavigateTo(NavigationManager.Uri, true);
}
catch (Exception ex)
{