Skip to content
This repository has been archived by the owner on May 10, 2020. It is now read-only.

Commit

Permalink
v0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
chanan committed Dec 6, 2018
1 parent 1e563e8 commit ae8cea2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 21 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ protected async override Task OnInitAsync()
}
```

## Note about the sample project

The Todo page does not work fully. The TodoForm that allows you to edit an item or add a new item is not working correctly. The OnInitAsync in the
child component is not firing. However, since BlazorDB itself it working, I decided to publish the version and figure out the Sample app afterwards.

## Docs

### Install
Expand Down
2 changes: 1 addition & 1 deletion src/BlazorDB/BlazorDB.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<BlazorLinkOnBuild>false</BlazorLinkOnBuild>
<LangVersion>7.3</LangVersion>
<PackageId>BlazorDB</PackageId>
<Version>0.7.0</Version>
<Version>0.7.1</Version>
<Authors>Chanan Braunstein</Authors>
<Title>Blazor localStorage Database</Title>
<Description>In memory, persisted to localstorage, database for .net Blazor browser framework</Description>
Expand Down
3 changes: 3 additions & 0 deletions src/BlazorDB/StorageContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace BlazorDB
public class StorageContext : IStorageContext
{
protected IStorageManager StorageManager { get; set; }
private bool _initalized = false;
public async Task LogToConsole()
{
await Logger.StartContextType(GetType(), false);
Expand All @@ -26,6 +27,8 @@ public Task<int> SaveChanges()

public Task Initialize()
{
if (_initalized) return Task.CompletedTask;
_initalized = true;
return StorageManager.LoadContextFromLocalStorage(this);
}
}
Expand Down
17 changes: 4 additions & 13 deletions src/Sample/Pages/TodoItemForm.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</div>
</div>
<div class="col-sm-10 offset-sm-2">
<button type="submit" class="btn btn-primary" onclick="@onclick">Submit</button>
<button type="button" class="btn btn-primary" onclick="@onclick">Submit</button>
</div>
</form>

Expand All @@ -33,23 +33,14 @@

protected async override Task OnInitAsync()
{
Console.WriteLine("OnInitAsync");
await Context.Initialize();
if (Context.Todos == null) await Context.Initialize();
if (SelectedId == 0) Todo = new TodoItem();
else
{
SetTodo();
}
else SetTodo();
}

protected async override Task OnParametersSetAsync()
{
Console.WriteLine("OnParametersSetAsync");
if (Context.Todos == null)
{
Console.WriteLine("OnParametersSetAsync - init");
await Context.Initialize();
}
if (Context.Todos == null) await Context.Initialize();
SetTodo();
}

Expand Down
3 changes: 1 addition & 2 deletions src/Sample/Pages/Todos.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</BlazorTable>
<button class="btn btn-primary" type="button" onclick="@addNewClick">Add New</button>
<h2>Selected Item</h2>
<TodoItemForm />
<TodoItemForm SelectedId="@SelectedId" NewTodoAdded="@NewTodoAdded" />

@functions {
string Filter { get; set; }
Expand Down Expand Up @@ -64,7 +64,6 @@

void onClickItem(int i)
{
Console.WriteLine("Todos onClickItem: {0}", i);
SelectedId = i;
StateHasChanged();
}
Expand Down

0 comments on commit ae8cea2

Please sign in to comment.