Coder Social home page Coder Social logo

Comments (3)

ikk3 avatar ikk3 commented on August 15, 2024 1

I changed from the template options posted previously and created another project with the settings below.

  • Interactive render mode : Auto
  • Interactivity location : Global

And I tried global @rendermode to

  • InteractiveServer
  • InteractiveWebAssembly
  • InteractiveWebAssemblyRenderMode(false) - turning off pre-rendering using SSR

, but the result remained the same, it cannot be connected with Redux DevTools.

(App.razor)

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <base href="/" />
    <link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
    <link rel="stylesheet" href="app.css" />
    <link rel="stylesheet" href="BlazorApp.Net8Template.InteractiveAutoGlobal.styles.css" />
    <link rel="icon" type="image/png" href="favicon.png" />
    @if (ApplyInteractiveServer())
    {
        <HeadOutlet @rendermode="InteractiveServer" />
    }
    else if (ApplyInteractiveWebAssembly())
    {
        <HeadOutlet @rendermode="InteractiveWebAssembly" />
    }
    else if (ApplyInteractiveWebAssemblyPreRenderOff())
    {
        <HeadOutlet @rendermode="new InteractiveWebAssemblyRenderMode(false)" />
    }
    else
    {
        <HeadOutlet @rendermode="InteractiveAuto" />
    }
</head>

<body>
    <MementoInitializer />

    @if (ApplyInteractiveServer())
    {
        <Routes @rendermode="InteractiveServer" />
    }
    else if (ApplyInteractiveWebAssembly())
    {
        <Routes @rendermode="InteractiveWebAssembly" />
    }
    else if (ApplyInteractiveWebAssemblyPreRenderOff())
    {
        <Routes @rendermode="new InteractiveWebAssemblyRenderMode(false)" />
    }
    else
    {
        <Routes @rendermode="InteractiveAuto" />
    }
    <script src="_framework/blazor.web.js"></script>
</body>

</html>

@inject NavigationManager NavigationManager
@code {
    private bool ApplyInteractiveServer()
    {
        return NavigationManager.Uri.EndsWith("/SSR", StringComparison.InvariantCultureIgnoreCase);
    }

    private bool ApplyInteractiveWebAssembly()
    {
        return NavigationManager.Uri.EndsWith("/WASM", StringComparison.InvariantCultureIgnoreCase);
    }

    private bool ApplyInteractiveWebAssemblyPreRenderOff()
    {
        return NavigationManager.Uri.EndsWith("/WASM-NOPR", StringComparison.InvariantCultureIgnoreCase);
    }
}

from memento.

le-nn avatar le-nn commented on August 15, 2024 1

@ikk3

Hi !
Thank you for reporting the issue.
You need to declare service registration for both Client Side Project and Server Side project.

Client Side

builder.Services
    .AddMemento()
    .AddBrowserReduxDevToolMiddleware(new() {
        StackTraceEnabled = true,
        OpenDevTool = true,
    })
    .ScanAssemblyAndAddStores(typeof(Memento.Sample.Blazor.App).Assembly);

Server Side

builder.Services
    .AddMemento()
    .AddBrowserReduxDevToolMiddleware(new() {
        StackTraceEnabled = true,
        OpenDevTool = true,
    }, true)
    .ScanAssemblyAndAddStores(typeof(Memento.Sample.Blazor._Imports).Assembly);

I have added the Blazor WebApp sample.

https://github.com/le-nn/memento/tree/main/samples/Memento.Samples.Blazor.WebApp

from memento.

ikk3 avatar ikk3 commented on August 15, 2024 1

@le-nn
Thank you for your reply.

I have confirmed that it is working with ReduxDevTools, in local execution by using
[samples/Memento.Samples.Blazor.WebApp]
referring to

  • samples/Memento.Sample.Blazor
    and the nuget package
  • Memento.ReduxDevTool.Browser(1.7.0)
  • Memento.Blazor(1.7.0)
  • Memento.Core(1.7.0)

It seems that
[Memento.Samples.Blazor.WebApp]
is applied to the VSTemplate of

  • Interactive render mode: Auto
  • Interactivity location: Global
    , so I think it is compatible with .NET8's @rendermode.

On the other hand, the project I am developing is

  • Interactive render mode: Auto
  • Interactivity location: Global
    so I tried to identify the difference between VSTemplate and
    [samples/Memento.Samples.Blazor.WebApp]
    ,and apply it, but integration with ReduxDevTools did not work well...

Thank you.

from memento.

Related Issues (18)

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.