Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,32 @@ public partial class RenderableContentControl : ComponentBase, IDisposable
public object Context
{
get => _context;
set { _context = value as ITwinElement; }
set
{
if (_context != value)
{
_context = value as ITwinElement;
this.ForceRender();
}
}
}

/// <summary>
/// Parameter Presentation specify mode, in which view UI is generated. Type PresentationType is used.
/// </summary>
[Parameter]
public string Presentation { get; set; }
public string Presentation
{
get => _presentation;
set
{
if (_presentation != value)
{
_presentation = value;
this.ForceRender();
}
}
}


/// <summary>
Expand All @@ -70,7 +88,6 @@ public object Context
/// </summary>
[Parameter]
public string LayoutChildrenClass { get; set; }

[Inject]
public ComponentService ComponentService { get; set; }
[Inject]
Expand All @@ -92,9 +109,18 @@ protected override void OnInitialized()
}
}

/// <summary>
/// Forces re-rendering of this rcc.
/// [!IMPORTANT] Forced re-rendering may impact client-side performance. The method is automatically called when <see cref="Presentation"/> or <see cref="Context"/> property change.
/// </summary>
public void ForceRender()
{
shouldRender = true;
this.StateHasChanged();
}

protected override void OnParametersSet()
{

Type layoutType = TryLoadLayoutTypeFromProperty(_context);
if (layoutType == null)
{
Expand Down Expand Up @@ -414,8 +440,17 @@ private string GetDisplayPresentationIfEmpty()

}

private bool shouldRender = false;
private string _presentation;

protected override bool ShouldRender()
{
if (shouldRender)
{
shouldRender = false;
return true;
}

return false;
}

Expand Down