Skip to content

fix: invalidate counter visual (#338) - #383

Merged
love-linger merged 2 commits into
sourcegit-scm:developfrom
gadfly3173:fix/counter-visual
Aug 21, 2024
Merged

fix: invalidate counter visual (#338)#383
love-linger merged 2 commits into
sourcegit-scm:developfrom
gadfly3173:fix/counter-visual

Conversation

@gadfly3173

Copy link
Copy Markdown
Contributor

Keep the same implementation as CommitRefsPresenter to avoid displaying the number of the previous DataContext

@love-linger

Copy link
Copy Markdown
Collaborator

CommitRefsPresenter depends on DataContext to draw contents. But CounterPresenter only depends on its own property CountProperty to draw contents.

static CounterPresenter()
{
    AffectsMeasure<CounterPresenter>(
        FontSizeProperty,
        FontFamilyProperty,
        ForegroundProperty,
        CountProperty);

    AffectsRender<CounterPresenter>(
        ForegroundProperty,
        BackgroundProperty,
        CountProperty);
}

The issue #338 still exists about this control?

@gadfly3173

gadfly3173 commented Aug 21, 2024

Copy link
Copy Markdown
Contributor Author

The issue #338 still exists about this control?

The current situation is that after switching repo, the number of the previous repo may be displayed. After making this change, I cannot reproduce the problem here.

image

@gadfly3173

Copy link
Copy Markdown
Contributor Author

CommitRefsPresenter depends on DataContext to draw contents. But CounterPresenter only depends on its own property CountProperty to draw contents.

static CounterPresenter()
{
    AffectsMeasure<CounterPresenter>(
        FontSizeProperty,
        FontFamilyProperty,
        ForegroundProperty,
        CountProperty);

    AffectsRender<CounterPresenter>(
        ForegroundProperty,
        BackgroundProperty,
        CountProperty);
}

It seems that OnDataContextChanged can be removed.

@love-linger

Copy link
Copy Markdown
Collaborator

Since you have added the InvalidateVisual in the end of MeasureOverride, I suggest you to remove the CountProperty from AffectsRender call.

@love-linger love-linger self-assigned this Aug 21, 2024
@love-linger love-linger added the bug Something isn't working label Aug 21, 2024
@gadfly3173

gadfly3173 commented Aug 21, 2024

Copy link
Copy Markdown
Contributor Author

Confirmed that AffectsRender can be all removed, change theme also would re-render this control.

@love-linger
love-linger merged commit 1992493 into sourcegit-scm:develop Aug 21, 2024
@gadfly3173
gadfly3173 deleted the fix/counter-visual branch August 21, 2024 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

2 participants