Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fixed in 0.75.1] PluginAdditionalOption.TextValue and other value properties are not persistent #29465

Closed
htcfreek opened this issue Oct 28, 2023 · 9 comments
Assignees
Labels
Hot Fix Items we will product an out-of-band release for Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. Run-Plugin Manager Issues with the PowerToys Run plugin manager Run-Plugin Things that relate with PowerToys Run's plugin interface

Comments

@htcfreek
Copy link
Collaborator

Is it me or PluginAdditionalOption.TextValue and other value properties added in this PR are not persistent?

I think defaultOption.TextValue = option.TextValue; and other assigments are missing.

// SettingsReader.cs

private static IEnumerable<PluginAdditionalOption> CombineAdditionalOptions(IEnumerable<PluginAdditionalOption> defaultAdditionalOptions, IEnumerable<PluginAdditionalOption> additionalOptions)
        {
            var defaultOptions = defaultAdditionalOptions.ToDictionary(x => x.Key);
            foreach (var option in additionalOptions)
            {
                if (option.Key != null && defaultOptions.TryGetValue(option.Key, out PluginAdditionalOption defaultOption))
                {
                    defaultOption.Value = option.Value;
                    // should add other value properties here
                }
            }

            return defaultOptions.Values;
        }

Originally posted by @waaverecords in #28601 (comment)

@htcfreek htcfreek added Issue-Bug Something isn't working Run-Plugin Things that relate with PowerToys Run's plugin interface Run-Plugin Manager Issues with the PowerToys Run plugin manager labels Oct 28, 2023
@htcfreek htcfreek self-assigned this Oct 28, 2023
@htcfreek htcfreek added the Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams label Oct 28, 2023
@htcfreek
Copy link
Collaborator Author

@waaverecords
Can you please provide a poc of how to run into this bug.

@waaverecords
Copy link
Contributor

Yes! @htcfreek

public class Main : IPlugin, ISettingProvider
{
    // ...

    IEnumerable<PluginAdditionalOption> ISettingProvider.AdditionalOptions => new List<PluginAdditionalOption>()
    {
        new PluginAdditionalOption
        {
            Key = "Textbox",
            DisplayLabel = "Textbox",
            PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Textbox
        },
        new PluginAdditionalOption
        {
            Key = "Bool",
            DisplayLabel = "Bool"
            // PluginOptionType is Checkbox by default
        }
    };
}

Change the value of both settings.
Close PowerToys.
Open PowerToys.

Only the "Bool" option has its value persisted.
"Textbox" value is back to null.

@htcfreek
Copy link
Collaborator Author

@lin-ycv
I am sure this is the bug you hit with your initial settings implementation.

@lin-ycv
Copy link

lin-ycv commented Oct 29, 2023

Yes, sounds like the same issue.
I didn't look too deep into it, basically just changed all the setting properties to public and use load to read the values.

@waaverecords
Copy link
Contributor

Pretty sure only SettingsReader.CombineAdditionalOptions needs modifications.
I'll look into it and make a PR if it's the case.

@htcfreek
Copy link
Collaborator Author

htcfreek commented Oct 29, 2023

Pretty sure only SettingsReader.CombineAdditionalOptions needs modifications.
I'll look into it and make a PR if it's the case.

@waaverecords
Great. Then I will change assignment to you.

@htcfreek htcfreek assigned waaverecords and unassigned htcfreek Oct 29, 2023
@htcfreek htcfreek added the Status-In progress This issue or work-item is under development label Oct 29, 2023
@waaverecords
Copy link
Contributor

PR request -> #29480

@htcfreek
Copy link
Collaborator Author

htcfreek commented Oct 29, 2023

@jaimecbernardo
As the 0.75.0 release is feature closed I think we can consider to include this issue in a hot fix if we have one.

@htcfreek htcfreek added the Hot Fix Items we will product an out-of-band release for label Oct 30, 2023
@htcfreek
Copy link
Collaborator Author

@jaimecbernardo
I have added the "Hot Fix" label. Hope you are okay with doing that.

@jaimecbernardo jaimecbernardo added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Status-In progress This issue or work-item is under development labels Oct 31, 2023
@stefansjfw stefansjfw changed the title PluginAdditionalOption.TextValue and other value properties are not persistent [Fixed in 0.75.1] PluginAdditionalOption.TextValue and other value properties are not persistent Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hot Fix Items we will product an out-of-band release for Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. Run-Plugin Manager Issues with the PowerToys Run plugin manager Run-Plugin Things that relate with PowerToys Run's plugin interface
Projects
None yet
Development

No branches or pull requests

5 participants