Merge pull request #4053 from sbwalker/dev
optimize SiteRouter to only call SyncService for Interactive render mode
This commit is contained in:
commit
6e7ce10585
|
@ -163,7 +163,9 @@
|
||||||
visitorId = PageState.VisitorId;
|
visitorId = PageState.VisitorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// process any sync events
|
if (PageState.RenderMode == RenderModes.Interactive)
|
||||||
|
{
|
||||||
|
// process any sync events (for synchrozing the client application with the server)
|
||||||
var sync = await SyncService.GetSyncEventsAsync(lastsyncdate);
|
var sync = await SyncService.GetSyncEventsAsync(lastsyncdate);
|
||||||
lastsyncdate = sync.SyncDate;
|
lastsyncdate = sync.SyncDate;
|
||||||
if (sync.SyncEvents.Any())
|
if (sync.SyncEvents.Any())
|
||||||
|
@ -174,24 +176,13 @@
|
||||||
NavigationManager.NavigateTo(_absoluteUri, true);
|
NavigationManager.NavigateTo(_absoluteUri, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// reload client application if site runtime/rendermode was modified
|
|
||||||
if (sync.SyncEvents.Exists(item => item.Action == SyncEventActions.Reload && item.EntityName == EntityNames.Site && item.EntityId == SiteState.Alias.SiteId))
|
|
||||||
{
|
|
||||||
NavigationManager.NavigateTo(_absoluteUri, true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// reload client application if current user auth information has changed
|
|
||||||
if (user != null && sync.SyncEvents.Exists(item => item.Action == SyncEventActions.Reload && item.EntityName == EntityNames.User && item.EntityId == user.UserId))
|
|
||||||
{
|
|
||||||
NavigationManager.NavigateTo(_absoluteUri, true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// refresh PageState when site information has changed
|
// refresh PageState when site information has changed
|
||||||
if (sync.SyncEvents.Exists(item => item.Action == SyncEventActions.Refresh && item.EntityName == EntityNames.Site && item.EntityId == SiteState.Alias.SiteId))
|
if (sync.SyncEvents.Exists(item => item.Action == SyncEventActions.Refresh && item.EntityName == EntityNames.Site && item.EntityId == SiteState.Alias.SiteId))
|
||||||
{
|
{
|
||||||
refresh = true;
|
refresh = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// get site
|
// get site
|
||||||
if (PageState == null || refresh || PageState.Alias.SiteId != SiteState.Alias.SiteId)
|
if (PageState == null || refresh || PageState.Alias.SiteId != SiteState.Alias.SiteId)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user