Skip to content

Commit a682b9b

Browse files
Merge pull request #21 from KristofferStrube/fix/fixed-method-that-would-break-for-null-response
Fixed that `ReadableByteStreamController.GetBYOBRequestAsync` could not handle when the `byobRequest` was `null`.
2 parents 78b3cfd + dc24bf6 commit a682b9b

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

.EditorConfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ dotnet_diagnostic.IDE0042.severity = suggestion
4242
dotnet_style_prefer_conditional_expression_over_assignment = true
4343
dotnet_diagnostic.IDE0045.severity = warning
4444
dotnet_style_prefer_conditional_expression_over_return = true
45-
dotnet_diagnostic.IDE0046.severity = warning
45+
dotnet_diagnostic.IDE0046.severity = silent
4646
dotnet_style_prefer_compound_assignment = true
4747
dotnet_diagnostic.IDE0054.severity = warning
4848
dotnet_diagnostic.IDE0074.severity = warning

src/KristofferStrube.Blazor.Streams/ReadableStream/ReadableByteStreamController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ protected internal ReadableByteStreamController(IJSRuntime jSRuntime, IJSObjectR
2929
/// <returns>A <see cref="ReadableStreamBYOBRequest"/></returns>
3030
public async Task<ReadableStreamBYOBRequest?> GetBYOBRequestAsync()
3131
{
32-
IJSObjectReference helper = await helperTask.Value;
33-
IJSObjectReference? jSInstance = await helper.InvokeAsync<IJSObjectReference?>("getAttribute", JSReference, "byobRequest");
32+
await using ValueReference valueReference = new(JSRuntime, JSReference, "byobRequest");
33+
var jSInstance = (IJSObjectReference?)await valueReference.GetValueAsync();
3434
if (jSInstance is null)
3535
{
3636
return null;

0 commit comments

Comments
 (0)