Coder Social home page Coder Social logo

Comments (10)

RyanTT avatar RyanTT commented on June 8, 2024 1

Hello,

do I understand correctly that you tried to use the library in the new Blazor App setting and in the traditional Blazor Server setting?

It should work with Blazor Server that existed prior to .NET 8, however the new Blazor (United) App setup is fundamentally different and I will need some time to figure out how to properly adjust the library to this.

If using Blazor App, it should still work as long as long as the components of this library are marked with the RenderModeServer attribute, this hasn't been done yet however as it will require the minimum .NET version to be upped to .NET 8, and also this doesn't seem desirable to force this usage.

I'll need to figure out some new approach to enable the usage in Blazor Apps.

from bytexdigital.blazor.components.cookieconsent.

RyanTT avatar RyanTT commented on June 8, 2024 1

For the meantime yes.

I'l need to find a solution that enables usage both in classic WebAssembly projects and in the new Blazor App projects that doesn't force you to use one specific rendering mode and which also enables access to the cookie consent data outside of interactive components.

from bytexdigital.blazor.components.cookieconsent.

RyanTT avatar RyanTT commented on June 8, 2024 1

I've pushed a test package version with support for the new Blazor Web App.
https://www.nuget.org/packages/BytexDigital.Blazor.Components.CookieConsent/1.1.0-preview.1693095817

Here are the updated installation instructions:
https://github.com/BytexDigital/BytexDigital.Blazor.Components.CookieConsent#how-to-install

Please let me know if it works out for you.

from bytexdigital.blazor.components.cookieconsent.

RyanTT avatar RyanTT commented on June 8, 2024 1

I've updated installation steps for Blazor Web Apps to explain when adding what is necessary. Please let me know if it's understandable.

from bytexdigital.blazor.components.cookieconsent.

ynnob avatar ynnob commented on June 8, 2024

Thanks for the fast response. Yes i am talking about the new Blazor Web App template in .Net 8 Preview SDK that conbines webassembly and ssr.

I guess i need to fallback to a classic manual cookie approach in the meantime.

from bytexdigital.blazor.components.cookieconsent.

RyanTT avatar RyanTT commented on June 8, 2024

@ynnob It seems that I was wrong about how future Blazor United projects work and compatibility should be pretty much almost there.

I'll try to get a template of the new Blazor United and see what's missing in the library for good compatibility with the current .NET 8 previews, then document it in the README.

from bytexdigital.blazor.components.cookieconsent.

ynnob avatar ynnob commented on June 8, 2024

@ynnob It seems that I was wrong about how future Blazor United projects work and compatibility should be pretty much almost there.

I'll try to get a template of the new Blazor United and see what's missing in the library for good compatibility with the current .NET 8 previews, then document it in the README.

Happy to hear that! Looking forward for it!

from bytexdigital.blazor.components.cookieconsent.

ynnob avatar ynnob commented on June 8, 2024

Hey! Looks good to me.
I implemented it and it just works. No problems so far.

Thanks man!

from bytexdigital.blazor.components.cookieconsent.

ynnob avatar ynnob commented on June 8, 2024

Hey @RyanTT whats the reason for A and B (1. Configure your App.razor)?

Because if i would use B for example i will get some console errors complaining about a missing dotnet.js file

image

Code:

    <BytexDigital.Blazor.Components.CookieConsent.CookieConsentHandler @rendermode="@RenderMode.Server" />
    <BytexDigital.Blazor.Components.CookieConsent.CookieConsentInitializer @rendermode="@RenderMode.WebAssembly" />

Changing the CookieConsentInitializer to RenderMode.Server does not display this error. But with and without the error it seems to work correctly.

Edit:
I have WebAssembly not activated in my project currently.

from bytexdigital.blazor.components.cookieconsent.

RyanTT avatar RyanTT commented on June 8, 2024

The cookie consent initializer has the job of making sure everything in WASM is hooked up correctly if you render the UI on the server instead. If you do not use WASM though, you can skip this (and as you can see it will error out if WASM isn't used by the rest of the app).

This is only necessary if you render the UI on one side and also have components interacting with the CookieConsent lib on the other side (e.g. rendered on Server but also used in WASM)

I forgot to update the docs for this use case

from bytexdigital.blazor.components.cookieconsent.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.