Skip to content

[Bug]: Placeholders are active when databinding is set #289

Description

@elpezganzo

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my problem.
  • I have, to the best of my knowledge, that this isn't an environmental issue (Sorry, we can't help troubleshoot your infrastructure).

Steps to Reproduce

$sequenceNumber = Get-Random -Minimum ([uint32]::MaxValue / 2) -Maximum ([uint32]::MaxValue - 1);
$uniqueId = [guid]::NewGuid().ToString();
Write-Host "Unique Identifier: $uniqueId";
Write-Host "Sequence Number : $sequenceNumber";

$labels = New-BTText -Style Base -Text 'unbind_title'
$values = New-BTText -Style BaseSubtle -Text 'unbind_subtitle'
$progress = New-BTProgressBar -Status "bind_status" -Value "bind_value" -ValueDisplay "bind_value_display"

$col1 = New-BTColumn -Children $labels -Weight 4;
$col2 = New-BTColumn -Children $values -Weight 6;

$binding = New-BTBinding -Column $col1, $col2 -Children $progress;
$visual = New-BTVisual -BindingGeneric $binding;
$content = New-BTContent -Visual $visual;
$Content.GetContent()
$data0 = @{
    unbind_title = 'Title 1';
    bind_example = 'Sub title 1';
    bind_status = 'Status initial'
    bind_value = 0.5;
    bind_value_display = 'Progress start';
};

Submit-BTNotification -Content $content -UniqueIdentifier $uniqueId -DataBinding $data0 -SequenceNumber $sequenceNumber;

Start-Sleep -Seconds 10;
$data = @{
    unbind_title = 'Title new';
    unbind_subtitle = 'Subtitle new';
    bind_status = 'Status final'
    bind_value = 0.7;
    bind_value_display = 'Progress end';
};

Update-BTNotification -UniqueIdentifier $uniqueId -DataBinding $data -SequenceNumber $sequenceNumber;

Expected Behavior

There are two possible expected behaviors:

  1. If the databinding works with all text, then the text must be replaced.
  2. It the databinding works only with Progress Bar, then the text must not be shown as placeholder.

The error occurs when DataBindig is set with something. Not necessarily an existent placeholder.

Actual Behavior

When you run the code you can notice:

  1. "unbind_title" and "unbind_subtitle" are converted to placeholders and these are not replaced by the text with databinding.
  2. The placeholders are replaced only for progress bar.

Experience with Toast

Beginner

Environment data: PowerShell

Name                           Value
----                           -----
PSVersion                      5.1.26100.7920
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.26100.7920
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Environment data: OS

Replace with the output of: Get-ComputerInfo | fl OsName, OsVersion, OsArchitecture

Environment data: BurntToast

ModuleType Version    Name       
---------- -------    ----       
Script     1.1.0      BurntToast

Consent to Attribution

  • Please shout me out if I've inspired a blog post!

Metadata

Metadata

Assignees

Labels

status: triageNeed to be assessed for validity and prioritytype: bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions