Skip to content

Commit

Permalink
Revert "Add ability for deferred props (#12)"
Browse files Browse the repository at this point in the history
This reverts commit e49634d.
  • Loading branch information
kapi2289 committed Apr 11, 2024
1 parent e49634d commit 27c7866
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 101 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
/.vs
/_ReSharper.Caches/
1 change: 0 additions & 1 deletion InertiaCore/Inertia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ public static class Inertia
public static void Share(IDictionary<string, object?> data) => _factory.Share(data);

public static LazyProp Lazy(Func<object?> callback) => _factory.Lazy(callback);
public static DeferProp Defer(Func<object?> callback) => _factory.Defer(callback);
}
1 change: 0 additions & 1 deletion InertiaCore/Models/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ namespace InertiaCore.Models;
internal class Page
{
public Dictionary<string, object?> Props { get; set; } = default!;
public Dictionary<string, object?>? DeferProps { get; set; } = default!;
public string Component { get; set; } = default!;
public string? Version { get; set; }
public string Url { get; set; } = default!;
Expand Down
8 changes: 1 addition & 7 deletions InertiaCore/Response.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,10 @@ protected internal void ProcessResponse()
else
{
var props = _props.GetType().GetProperties()
.Where(o => o.PropertyType != typeof(LazyProp) && o.PropertyType != typeof(DeferProp))
.Where(o => o.PropertyType != typeof(LazyProp))
.ToDictionary(o => o.Name.ToCamelCase(), o => o.GetValue(_props));

page.Props = props;

var deferProps = _props.GetType().GetProperties()
.Where(o => o.PropertyType == typeof(DeferProp))
.ToDictionary(o => o.Name.ToCamelCase(), o => o.GetValue(_props));

page.DeferProps = PrepareProps(deferProps);
}

page.Props = PrepareProps(page.Props);
Expand Down
3 changes: 0 additions & 3 deletions InertiaCore/ResponseFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ internal interface IResponseFactory
public void Share(string key, object? value);
public void Share(IDictionary<string, object?> data);
public LazyProp Lazy(Func<object?> callback);
public DeferProp Defer(Func<object?> callback);
}

internal class ResponseFactory : IResponseFactory
Expand Down Expand Up @@ -120,6 +119,4 @@ public void Share(IDictionary<string, object?> data)
}

public LazyProp Lazy(Func<object?> callback) => new(callback);

public DeferProp Defer(Func<object?> callback) => new(callback);
}
8 changes: 0 additions & 8 deletions InertiaCore/Utils/DeferProp.cs

This file was deleted.

74 changes: 0 additions & 74 deletions InertiaCoreTests/UnitTestDeferData.cs

This file was deleted.

5 changes: 0 additions & 5 deletions InertiaCoreTests/UnitTestPartialData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ public void TestPartialData()
{
Assert.Fail();
return "Lazy";
}),
TestDefer = _factory.Defer(() =>
{
Assert.Fail();
return "Defer";
})
});

Expand Down

0 comments on commit 27c7866

Please sign in to comment.