Weird issue with stepper and loading results

Hey,

So I have the following configuration and everything works great, however once the table loads it then reloads and removes the tabs:

New-UDCard -Title "Activity Reporter" -Content {
	$session:report = $null
	New-UDStepper -id "ActivityReporter" -Steps {		
		New-UDStep -OnLoad {
			New-UDElement -tag 'div' -Content { "Client" }
			New-UDSelect -id "Client" -option {
				New-UDSelectOption -name "Select a client" -Value "Select a client"
				foreach ($Client in $session:DevolutionsVaults)
				{
					New-UDSelectOption -name $Client.name -Value $Client.name
				}
			}
		} -Label "Step 1" 
		New-UDStep -OnLoad {
			$LastResults = $Body | ConvertFrom-Json 
			New-UDElement -tag 'div' -Content { "Client: " + $LastResults.context.Client}
			New-UDElement -tag 'div' -Content { "From Date" }
			New-UDDatePicker -ID "FromDate" -value (get-date).AddMonths(-1) -Variant static
		} -Label "Step 2"
		New-UDStep -OnLoad {
			$LastResults = $Body | ConvertFrom-Json 
			New-UDElement -tag 'div' -Content { "Client: " + $LastResults.context.Client}
			New-UDElement -tag 'div' -Content { "From Date: " +  $LastResults.context.FromDate}
			New-UDElement -tag 'div' -Content { "To Date" }
			New-UDDatePicker -ID "ToDate"  -Variant static
		} -Label "Step 3"
		New-UDStep -OnLoad {
			$LastResults = $Body | ConvertFrom-Json 
			New-UDElement -tag 'div' -Content { "Client: " + $LastResults.context.Client}
			New-UDElement -tag 'div' -Content { "From Date: " +  $LastResults.context.FromDate}
			New-UDElement -tag 'div' -Content { "To Date: " +  $LastResults.context.ToDate}
			New-UDElement -tag 'div' -Content { "From Time" }
			New-UDTimePicker -ID "FromTime" -value (get-date -Date "1970-01-01 09:00:00")
		} -Label "Step 4"
		New-UDStep -OnLoad {
			$LastResults = $Body | ConvertFrom-Json 
			New-UDElement -tag 'div' -Content { "Client: " + $LastResults.context.Client}
			New-UDElement -tag 'div' -Content { "From Date: " +  $LastResults.context.FromDate}
			New-UDElement -tag 'div' -Content { "To Date: " +  $LastResults.context.ToDate}
			New-UDElement -tag 'div' -Content { "From Time: " +  $LastResults.context.FromTime}
			New-UDElement -tag 'div' -Content { "ToTime" }
			New-UDTimePicker -ID "ToTime" -value (get-date -Date "1970-01-01 11:55:00PM")
		} -Label "Step 5"
	} -OnFinish {
		$LastResults = $Body | ConvertFrom-Json 
		$FromDateTime =  (get-date -date ((get-date -date $LastResults.context.FromDate).ToShortDateString()+" "+ (get-date -date $LastResults.context.FromTime).ToShortTimeString())).ToString("yyyy-MM-dd HH:mm:ss")
		$ToDateTime =  (get-date -date ((get-date -date $LastResults.context.ToDate).ToShortDateString()+" "+ (get-date -date $LastResults.context.ToTime).ToShortTimeString())).ToString("yyyy-MM-dd HH:mm:ss")
		$vaultID = ($session:DevolutionsVaults| where {$_.name -like $LastResults.context.Client}).id
		New-UDDynamic -Id 'content' -Content {
			if ($session:report -eq $null) {
				New-UDSkeleton -Variant rect -Width 800 -Height 500 -Animation wave
			}
			else {
				New-UDCard -Title "Report" -Content {
					New-UDTable -filter -Data ($session:report | select LoggedUserName,Message,ConnectionName,ConnectionTypeName,StartDateTimeUTC,EndDateTimeUTC) -Export
				}
			}
		}
		New-UDDynamic -Id 'background' -Content {
			if ($session:report -eq $null) {
				$session:report = Invoke-Sqlcmd -ServerInstance "server" -Database "EDGETGCLOUD-DV" -Query "SELECT * FROM ConnectionLog WHERE (MessageType = 4 or MessageType = 43) and RepositoryID = '$vaultID' AND CreationDate < '$ToDateTime' and CreationDate >= '$FromDateTime' ORDER BY CreationDate DESC"
				Sync-UDElement -Id 'content'
			}
		}
	} -Orientation 'vertical'
}


For a second everything displays correctly then it refreshes and displays just the table and nothing else.

Any thoughts

I used the same name as the main page for the dynamic regions, not paying attention. That seems to have been the cause of the issue. All fixed now.

1 Like