Skip to content

Commit 8b70c3b

Browse files
committed
removed the hack since we have 0.5.1 fix
1 parent 7420689 commit 8b70c3b

File tree

6 files changed

+10
-19
lines changed

6 files changed

+10
-19
lines changed

src/Blazor.Extensions.Storage.JS/Blazor.Extensions.Storage.JS.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</PropertyGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.5.0" />
19+
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.5.1" />
2020
<WebpackInputs Include="**\*.ts" Exclude="dist\**;node_modules\**" />
2121
</ItemGroup>
2222

src/Blazor.Extensions.Storage.JS/src/Initialize.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ class BrowserStorage implements IBrowserStorage {
2121
public GetItem(storage: string, key: string): any {
2222
let item = window[storage].getItem(key);
2323
if (item) {
24-
// HACK: While we wait for https://github.com/aspnet/Blazor/issues/1205 to be fixed we just send back a string and deserialize it in C# land
25-
return item;
26-
//return JSON.parse(item);
24+
return JSON.parse(item);
2725
}
28-
2926
return null;
3027
};
3128

src/Blazor.Extensions.Storage/Blazor.Extensions.Storage.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.5.0" />
14+
<PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.5.1" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

src/Blazor.Extensions.Storage/LocalStorage.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ public class LocalStorage : IStorage
1010
public Task<int> Length() => JSRuntime.Current.InvokeAsync<int>(MethodNames.LENGTH_METHOD, StorageTypeNames.LOCAL_STORAGE);
1111
public Task Clear() => JSRuntime.Current.InvokeAsync<object>(MethodNames.CLEAR_METHOD, StorageTypeNames.LOCAL_STORAGE);
1212

13-
public async Task<TItem> GetItem<TItem>(string key)
13+
public Task<TItem> GetItem<TItem>(string key)
1414
{
1515
if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key));
1616

17-
// HACK: While we wait for https://github.com/aspnet/Blazor/issues/1205 to be fixed we just get back a string and deserialize it in C# land
18-
var json = await JSRuntime.Current.InvokeAsync<string>(MethodNames.GET_ITEM_METHOD, StorageTypeNames.LOCAL_STORAGE, key);
19-
20-
return Json.Deserialize<TItem>(json);
17+
return JSRuntime.Current.InvokeAsync<TItem>(MethodNames.GET_ITEM_METHOD, StorageTypeNames.LOCAL_STORAGE, key);
2118
}
2219

2320
public Task<string> Key(int index) => JSRuntime.Current.InvokeAsync<string>(MethodNames.KEY_METHOD, StorageTypeNames.LOCAL_STORAGE, index);

src/Blazor.Extensions.Storage/SessionStorage.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ public class SessionStorage : IStorage
1010
public Task<int> Length() => JSRuntime.Current.InvokeAsync<int>(MethodNames.LENGTH_METHOD, StorageTypeNames.SESSION_STORAGE);
1111
public Task Clear() => JSRuntime.Current.InvokeAsync<object>(MethodNames.CLEAR_METHOD, StorageTypeNames.SESSION_STORAGE);
1212

13-
public async Task<TItem> GetItem<TItem>(string key)
13+
public Task<TItem> GetItem<TItem>(string key)
1414
{
1515
if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key));
1616

17-
// HACK: While we wait for https://github.com/aspnet/Blazor/issues/1205 to be fixed we just get back a string and deserialize it in C# land
18-
var json = await JSRuntime.Current.InvokeAsync<object>(MethodNames.GET_ITEM_METHOD, StorageTypeNames.SESSION_STORAGE, key);
19-
20-
return Json.Deserialize<TItem>(json.ToString());
17+
return JSRuntime.Current.InvokeAsync<TItem>(MethodNames.GET_ITEM_METHOD, StorageTypeNames.SESSION_STORAGE, key);
2118
}
2219

2320
public Task<string> Key(int index) => JSRuntime.Current.InvokeAsync<string>(MethodNames.KEY_METHOD, StorageTypeNames.SESSION_STORAGE, index);

test/Blazor.Extensions.Storage.Test/Blazor.Extensions.Storage.Test.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Blazor.Extensions.Logging" Version="0.1.7" />
12-
<PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.5.0" />
13-
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.5.0" />
14-
<DotNetCliToolReference Include="Microsoft.AspNetCore.Blazor.Cli" Version="0.5.0" />
12+
<PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.5.1" />
13+
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.5.1" />
14+
<DotNetCliToolReference Include="Microsoft.AspNetCore.Blazor.Cli" Version="0.5.1" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

0 commit comments

Comments
 (0)