[frontend] Clean up warnings

This commit is contained in:
Lilian 2024-06-20 19:26:34 +02:00 committed by Laura Hausmann
parent 868311a5a2
commit 54ff8efa1f
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
10 changed files with 32 additions and 36 deletions

View file

@ -23,9 +23,9 @@
</dialog> </dialog>
@code { @code {
[Parameter][EditorRequired] public IList<NoteAttachment> Attachments { get; set; } [Parameter][EditorRequired] public required IList<NoteAttachment> Attachments { get; set; }
private ElementReference Dialog { get; set; } private ElementReference Dialog { get; set; }
private IJSObjectReference? Module { get; set; } private IJSObjectReference Module { get; set; } = null!;
private int Focused { get; set; } private int Focused { get; set; }
private List<ElementReference> _refs = []; private List<ElementReference> _refs = [];
public ElementReference Ref { set => _refs.Add(value); } public ElementReference Ref { set => _refs.Add(value); }

View file

@ -46,9 +46,9 @@
@code { @code {
private ElementReference Dialog { get; set; } private ElementReference Dialog { get; set; }
private IJSObjectReference? _module; private IJSObjectReference _module = null!;
private IList<DriveFileResponse> Attachments { get; set; } = []; private IList<DriveFileResponse> Attachments { get; set; } = [];
private InputFile UploadInput { get; set; } private InputFile UploadInput { get; set; } = null!;
private NoteBase? ReplyOrQuote { get; set; } private NoteBase? ReplyOrQuote { get; set; }
private string? TextPlaceholder { get; set; } private string? TextPlaceholder { get; set; }
private NoteCreateRequest NoteDraft { get; set; } = new NoteCreateRequest private NoteCreateRequest NoteDraft { get; set; } = new NoteCreateRequest

View file

@ -15,7 +15,7 @@
} }
@code { @code {
private TBind _value; private TBind _value = default!;
[Parameter] [EditorRequired] public required IEnumerable<DropdownElement<TBind>> Elements { get; set; } [Parameter] [EditorRequired] public required IEnumerable<DropdownElement<TBind>> Elements { get; set; }
[Parameter] [Parameter]

View file

@ -11,10 +11,10 @@
</div> </div>
@code { @code {
[Parameter] [EditorRequired] public required IList<NoteAttachment> Attachments { get; set; } [Parameter] [EditorRequired] public required IList<NoteAttachment> Attachments { get; set; }
private AttachmentView View { get; set; } private AttachmentView View { get; set; } = null!;
private void Open() private async void Open()
{ {
View.OpenDialog(); await View.OpenDialog();
} }
} }

View file

@ -59,7 +59,7 @@
[Parameter] [EditorRequired] public required int Renotes { get; set; } [Parameter] [EditorRequired] public required int Renotes { get; set; }
[Parameter] public bool RenotePossible { get; set; } [Parameter] public bool RenotePossible { get; set; }
[CascadingParameter] NoteComponent NoteComponent { get; set; } [CascadingParameter] NoteComponent NoteComponent { get; set; } = null!;
private void Like() private void Like()
{ {

View file

@ -16,7 +16,7 @@
</button> </button>
@code { @code {
[Parameter][EditorRequired] public required NoteReactionSchema Reaction { get; set; } [Parameter][EditorRequired] public required NoteReactionSchema Reaction { get; set; }
[CascadingParameter] NoteComponent NoteComponent { get; set; } [CascadingParameter] NoteComponent NoteComponent { get; set; } = null!;
private void React() private void React()
{ {

View file

@ -59,7 +59,7 @@
} }
private bool _interlock = false; private bool _interlock = false;
private IJSObjectReference Module { get; set; } private IJSObjectReference Module { get; set; } = null!;
private void InitialRender(string? id) private void InitialRender(string? id)
{ {
@ -127,9 +127,6 @@
{ {
heightChange += State.Height[el.Id]; heightChange += State.Height[el.Id];
} }
else
{
}
} }
if (State.PadBottom > 0) State.PadBottom -= heightChange; if (State.PadBottom > 0) State.PadBottom -= heightChange;
@ -237,7 +234,7 @@
await Module.InvokeVoidAsync("SetScrollTop", State.ScrollTop, Scroller); await Module.InvokeVoidAsync("SetScrollTop", State.ScrollTop, Scroller);
} }
protected override async Task OnInitializedAsync() protected override void OnInitialized()
{ {
try try
{ {

View file

@ -54,11 +54,11 @@
<Compose @ref="_compose"/> <Compose @ref="_compose"/>
@code { @code {
private Compose _compose; private Compose _compose = null!;
private void Open() private async void Open()
{ {
_compose.OpenDialog(); await _compose.OpenDialog();
} }
} }

View file

@ -69,9 +69,9 @@
private bool _error = false; private bool _error = false;
private bool _fetchLock = false; private bool _fetchLock = false;
private async Task GetNotes(string? _minId) private async Task GetNotes(string? minId)
{ {
var pq = new PaginationQuery() { Limit = 10, MaxId = _minId }; var pq = new PaginationQuery() { Limit = 10, MaxId = minId };
var notes = await Api.Users.GetUserNotes(UserResponse.Id, pq); var notes = await Api.Users.GetUserNotes(UserResponse.Id, pq);
if (notes is not null && notes.Count > 0) if (notes is not null && notes.Count > 0)
{ {
@ -112,13 +112,13 @@
{ {
UserResponse = userResponse; UserResponse = userResponse;
Profile = await Api.Users.GetUserProfile(UserResponse.Id); Profile = await Api.Users.GetUserProfile(UserResponse.Id);
GetNotes(null); await GetNotes(null);
_init = true; _init = true;
_loading = false; _loading = false;
} }
} }
} }
catch (ApiException e) catch (ApiException)
{ {
_loading = false; _loading = false;
_error = true; _error = true;

View file

@ -55,8 +55,6 @@ else
private bool _init = false; private bool _init = false;
private bool _error = false; private bool _error = false;
protected override async Task OnInitializedAsync() { }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
_init = false; _init = false;
@ -89,7 +87,8 @@ else
if (_init) if (_init)
{ {
await Module.InvokeVoidAsync("ScrollIntoView", RootNoteRef); await (Module ?? throw new InvalidOperationException("JS interop not initialized"))
.InvokeVoidAsync("ScrollIntoView", RootNoteRef);
} }
} }