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

Fixed a bug with GetFilteredContentByTag #454

Merged

Conversation

degenone
Copy link
Contributor

@degenone degenone commented Jun 29, 2024

When navigationg to /Moderation I got an error:

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: An unexpected error occurred invoking 'GetFilteredContentByTag' on the server.
Microsoft.AspNetCore.SignalR.HubException: An unexpected error occurred invoking 'GetFilteredContentByTag' on the server.
   at Microsoft.AspNetCore.SignalR.Client.HubConnection.InvokeCoreAsyncCore(String methodName, Type returnType, Object[] args, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.SignalR.Client.HubConnection.InvokeCoreAsync(String methodName, Type returnType, Object[] args, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.SignalR.Client.HubConnectionExtensions.<InvokeCoreAsync>d__43`1[[System.Collections.Generic.IEnumerable`1[[TagzApp.ViewModels.Data.ModerationContentModel, TagzApp.ViewModels, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at TagzApp.Blazor.Client.Components.Pages.Moderation.InitializeContent() in C:\Users\terpp\dev\TagzApp\src\TagzApp.Blazor.Client\Components\Pages\Moderation.razor:line 337
   at TagzApp.Blazor.Client.Components.Pages.Moderation.OnInitializedAsync() in C:\Users\terpp\dev\TagzApp\src\TagzApp.Blazor.Client\Components\Pages\Moderation.razor:line 171
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

Adding the following code to ModerationHub.GetFilteredContentByTag

string negOne = "-1";
Console.WriteLine($"state({state}) == negOne({negOne}) ? {state == negOne} | signs: state({(int)state[0]}) negOne({(int)negOne[0]})");

It prints state(−1) == negOne(-1) ? False | signs: state(8722) negOne(45).

I felt that the simplest change was to have state be an int instead of string and this fixed the bug.

@csharpfritz csharpfritz merged commit 234eafb into FritzAndFriends:main Jul 2, 2024
2 checks passed
@degenone degenone deleted the bug_GetFilteredContentByTag branch July 9, 2024 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants