Closed lus closed 3 months ago
I don't understand. Which parameters are ignored/reset?
The OfficeColor
parameter in particular seems to be ignored in this case. The background color randomizes everytime the panel is (re-)opened and the primaryColor
field in the local settings is being set to a (random?) hex code,
I can't replicate that with the code you supplied. Need a more complete example or repo.
A randomizing background (you mean accent?) color must come from somewhere else as nothing is being done with that in the code you posted,
I will try to set up a minimal example as the code this is happening in is confidential.
Hello again. I have created a minimal example with which I could reproduce the issue. I want to make clear that I don't want to rule out that the issue is due to some fundamental misunderstanding of mine about how the component lifecycle affects things.
The repo:
https://github.com/lus/FluentThemeBugRepro
A video showcasing the whole process:
https://github.com/microsoft/fluentui-blazor/assets/46935044/2b014c8f-97d9-49c5-addd-d1522d2d1942
In your video, the color in storage is not being changed on selecting one from the dropdown. When I run the repro code locally, that does happen. I'm a little lost on what the issue is exactly
I also don't fully understand why that happens. Pay attention to my timing in the video as well. The "bug" only occurs when making changes after the Task in OnInitializedAsync has finished as it seems.
And when is that point in the video? What am I seeing then that is different? Sorry, I don't understand what your "bug" is.
As you have already said, "the color in storage is not being changed on selecting one from the dropdown". This is the bug I am facing and the reason for this issue. My last comment was just meant as a hint for your attempt on reproducing the issue. I am sorry if I am explaining it a bit confusing, English is not my native language.
No excuse needed. It is not mine either π
Ok, so now that we have established that the bug is that the changed color is not reflected in storage, how can I replicate that in the code repro you created. As seen in my 'video', it just worked after cloning, building and running it. No changes made whatsoever.
Alright, I think I have narrowed it down. Please try the following steps:
This provokes the bug on my side.
This seems to be due to a default (random) color selection, which is not updated correctly when a delay is applied (1000ms). This will be corrected in the next version.
Is it the correct result?
This looks promising, thank you very much for looking into it!
Closing this as PR is merged and will be in next release.
π Bug Report
I am trying to realize a simple panel to manage the page appearance, just like on the demo page. To do this, I have created the two parameters (mode and officeColor) in the panel component's code area and bound them to their corresponding
FluentDesignTheme
andFluentSelect
components. This works when not including any more code in the panel component. As soon as any state is given to the component (using itsContent
parameter) or even ifOnInitializedAsync
is implemented, the parameters will be ignored and are reset everytime the panel is opened.π» Repro or Code Sample
Working example:
Failing example:
In the
MainLayout.razor
I have added<FluentDesignTheme StorageName="theme"/>
and the panel is opened using this method:π€ Expected Behavior
I expect the parameters to be bound and loaded correctly.
π― Current Behavior
As staed above.
π¦ Context
As stated above.
π Your Environment