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

[Bug]: ReactiveUI.Blazor - Using ReactiveInjectableComponentBase<T> renders the view twice #3256

Open
Lukzy opened this issue May 4, 2022 · 2 comments
Labels

Comments

@Lukzy
Copy link

Lukzy commented May 4, 2022

Describe the bug 🐞

If I inherit from ReactiveInjectableComponentBase<T> to attach a ViewModel to a View, the View gets rendered twice on each activation.

For comparison, the same View and ViewModel with the ViewModel being attached by an [Inject] attribute, the View is rendered only once.

Step to reproduce

Check the linked reproduction repository.

  • ViewWithInherits.razor uses @inherits ReactiveInjectableComponentBase<T> and will be rendered twice
  • ViewWithInject.razor uses [Inject] attribute and will be rendered once

I verified the number of render cycles with the debugger, the counter property and Trace message (not in the example).

Reproduction repository

https://github.com/Lukzy/ReactiveUI.ExecutedTwiceBug

Expected behavior

Both ways of attaching a ViewModel should behave the same. I would expect the View to be only rendered once.

Screenshots 🖼️

No response

IDE

Visual Studio 2022

Operating system

Windows 10 Enterprise

Version

10.0.19044 Build 19044

Device

LENOVO X1

ReactiveUI Version

18.0.10

Additional information ℹ️

Behavior tested with these browsers:

  • Microsoft Edge - Version 101.0.1210.32 (Official build) (64-bit)
  • Google Chrome - Version 100.0.4896.127 (Official Build) (64-bit)
  • Firefox - Version 97.0.2 (32-bit)
@Lukzy Lukzy added the bug label May 4, 2022
@iashaik
Copy link

iashaik commented Sep 26, 2022

I spent few hours trying to figure out what I did that was wrong.

@M0n7y5
Copy link

M0n7y5 commented Dec 5, 2023

This bug is still present in the latest version 19.5.1. It looks like it gets rendered again from ReactiveInjectableComponentBase.OnAfterRender.
image

Also changing the render mode does not help ether. This bug is really bad and i dont get why its not fixed yet. Is ReactiveUI for blazor dead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants