Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 03 2019 12:11
    dotnet-maestro[bot] commented #1813
  • Jun 03 2019 12:11

    dotnet-maestro[bot] on darc-master-a926ae60-afdc-46d8-aabc-bb225655c15e

    (compare)

  • Jun 03 2019 12:11

    dotnet-maestro[bot] on master

    Update dependencies from https:… (compare)

  • Jun 03 2019 12:11
    dotnet-maestro[bot] closed #1813
  • Jun 03 2019 12:06
    dotnet-maestro[bot] opened #1813
  • Jun 03 2019 12:06

    dotnet-maestro[bot] on darc-master-a926ae60-afdc-46d8-aabc-bb225655c15e

    Update dependencies from https:… (compare)

  • Jun 03 2019 12:05

    dotnet-maestro[bot] on darc-master-a926ae60-afdc-46d8-aabc-bb225655c15e

    (compare)

  • May 30 2019 11:54
    jenergm commented #279
  • May 29 2019 14:59
    tmenier commented #1492
  • May 29 2019 04:58
    danroth27 updated the wiki
  • May 28 2019 14:25
    lewing commented #1807
  • May 27 2019 19:13
    matheusjulio96 commented #1652
  • May 27 2019 13:30
    springy76 commented #306
  • May 27 2019 13:13
    SQL-MisterMagoo commented #306
  • May 27 2019 13:07
    springy76 commented #306
  • May 27 2019 13:06
    springy76 commented #306
  • May 27 2019 12:24
    SQL-MisterMagoo commented #306
  • May 27 2019 12:20
    springy76 commented #306
  • May 27 2019 12:10
    dotnet-maestro[bot] commented #1812
  • May 27 2019 12:10

    dotnet-maestro[bot] on darc-master-e3474f54-f92f-4c3f-b116-ed9bdfe9754d

    (compare)

Robert Dailey
@rcdailey
oh ok that's much better than I thought. Thank you.
gismofx
@gismofx
Yup
let blazor render, then you manupulate your js component and tell blazor not to render your component any more
Robert Dailey
@rcdailey
I still don't understand the telling it not to render anymore
User refreshes tab -> prerender -> done?
The docs do say that OnAfterRender is called twice (the second time after SignalR connection is established)
is the ShouldRender() false supposed to stop the second call?
Trying to understand the behavioral difference and benefit
gismofx
@gismofx
Thats full blown refresh/lifecycle
Yes, false for any suqsequent re-renders
Mario van Zeist
@MariovanZeist
ShouldRender() => false can be used for optimization, for when for example you have a component that never changes it's appearance after the initial render.
Robert Dailey
@rcdailey
Appearance: does that include any changes to the view driven by data binding? For example, lists I bind to the view with @foreach, or single value properties I bind to component attributes?
If so, that's almost always going to be the case. I rarely have a static page with no binding.
Mario van Zeist
@MariovanZeist
Yeah, so if you have [parameters] that change your appearance then you are better of not using ShouldRender() => false
Unless you know what you are doing, but that's a bit of an advanced topic
Robert Dailey
@rcdailey
In my mind I'd hope that the framework is smart enough to effectively not rerender if nothing bound to an element changes. But maybe there's some weeds/implementation detail that I am ignorant of
Mario van Zeist
@MariovanZeist
So i would recommend forgetting about ShouldRender for now, unless you have performance issues
Robert Dailey
@rcdailey
Sure, it's good to know though. Thank you.
Mario van Zeist
@MariovanZeist
It does not always rerender, it is kinda "smart"
Robert Dailey
@rcdailey
I bet ShouldRender is useful in cases where you do a ton of UI updates but don't want to render each one. So you say false for all but the last one or something. Or use it as a way to disable automatic StateHasChanged() calls in favor of 100% control
I remember having similar UI render challenges in Winforms when updating huge lists of data
Mario van Zeist
@MariovanZeist
@rcdailey Yep
Simon Ziegler
@simonziegler:matrix.org
[m]

I've got my file download things working. Blazor sends a request to an authorized API to be able to download a file and gets back a token (that the API uses to know which file to build. You then download the file with the following TS:

export function downloadFile(fileUri): void {
    let anchorElement = document.createElement('a');
    anchorElement.download = "true";
    anchorElement.href = fileUri;
    anchorElement.click();
    anchorElement.remove();
}

@SQL-MisterMagoo you mentioned to add the target="_blank" attribute to the download link. This causes a new browser tab to appear ever so briefly. Turns out there's a download attribute to use instead.

MisterMagoo
@mistermagoo:matrix.org
[m]
@simonziegler I mentioned both the download attribute and target='_new' but the latter is only for old Blazor before they fixed a problem with the download attribute
Simon Ziegler
@simonziegler:matrix.org
[m]
Oh! Then I read too fast and missed the point!
My goof
gismofx
@gismofx
@rcdailey my pickle is getting /some/ data to render the divs and then more data after used to initialize the JS part.
gismofx
@gismofx
Anyone know how/if its possible to to invoke js and get the return value using bUnit?
Peter Morris
@mrpmorris
@MariovanZeist - dotnet/aspnetcore#14962
Mario van Zeist
@MariovanZeist
I know, but they wanted another approach.
And frankly I kinda like their approach.
@mrpmorris But at least Steve used a bit from another PR I submitted. dotnet/aspnetcore#33751
Mario van Zeist
@MariovanZeist
AH I see they might abandon it completly..
Anon
@makotech222
upgraded my blazor wasm to p6, getting this error when starting up:
src/mono/mono/metadata/icall.c:6619
sorry, thats
/__w/1/s/src/mono/mono/metadata/icall.c:6619 <disabled>
undefined
RuntimeError: abort(undefined). Build with -s ASSERTIONS=1 for more info.
Anon
@makotech222
seems to be caused by simply installing .net 6p6 sdk, not even from referencing the new packages
going back to p5
hmm uninstalled p6 and reinstalled p5, still same problem!
Peter Morris
@mrpmorris
Abandoning it completely is a bad idea
Anon
@makotech222
hmm not sure what fixed it, but its working now back on p5
Mario van Zeist
@MariovanZeist
I Agree. I think that they want the community to take this up, as it's not a top priority issue, and they are busy getting net 6 done
My PR Worked, but had some drawbacks, of which the main was that it couldn't facilitate async callbacks.
And it had the evenst in the NavigationManager, but I think they preferred to put it somewhere in the router
But the Api design was never fleshed out.
SQL-MisterMagoo
@SQL-MisterMagoo

@optimizasean I think I found a way to get your navigationmanager based policy to work - maybe, but only by using RequireAssertion.

Your comment about NavigationManager being "stuck" was, I think, slightly off - it's the RequireClaim that gets "stuck" - it is only evaluated at startup, so only returns resource Ids for the base url (or whatever url you first load)

RequireAssertion uses a Func that is called every time the policy is checked, so in there you can happily reference the current URL and check the claims.

This was just a quick test to see if it works - and it does - not saying that checking claims that way is correct, just "does it work as an idea"

Program.cs

NavigationManager navMan = default;
builder.Services.AddAuthorizationCore(options =>
{
    options.AddPolicy(Policies.CanAccessResource, builder=>Policies.CanAccessResourcePolicy(builder,navMan));
});
var app = builder.Build();
navMan = app.Services.GetRequiredService<NavigationManager>();
await app.RunAsync();

Policies.cs

public static AuthorizationPolicy CanAccessResourcePolicy(AuthorizationPolicyBuilder builder, NavigationManager navMan)
    => builder.RequireAssertion(context => {
        var resourceIds = GetResourceValues(new List<int>() { 2, 3, 5, 6 }, navMan);
        return context.User.HasClaim(claim =>
            claim.Type == "ResourceName" && resourceIds.Contains(claim.Value)
            );
        }).Build();
5 replies
AlbertoPa @AlbertoPa tries to make a blazor desktop app
Alberto Passalacqua
@AlbertoPa
only 20 GB of stuff needed to start :laughing: