Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi committed Jan 10, 2025
2 parents 4527bc5 + 546056d commit a8b9ccc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private void HandleOnSwipeMove(BitSwipeTrapEventArgs args)
else
{
var diff = args.DiffY - _oldDiffY;
_js.BitExtrasScrollBy(RootElement, 0, diff > 0 ? -10 : 10);
_js.BitExtrasScrollBy(RootElement, 0, diff > 0 ? -20 : 20);
_oldDiffY = args.DiffY;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
namespace Bit.BlazorUI;

internal static class BitExtrasJsRuntimeExtensions
internal static class ExtrasJsRuntimeExtensions
{
internal static ValueTask BitExtrasApplyRootClasses(this IJSRuntime jsRuntime, List<string> cssClasses, Dictionary<string, string> cssVariables)
{
return jsRuntime.InvokeVoid("BitBlazorUI.BitExtras.applyRootClasses", cssClasses, cssVariables);
return jsRuntime.InvokeVoid("BitBlazorUI.Extras.applyRootClasses", cssClasses, cssVariables);
}

internal static ValueTask BitExtrasGoToTop(this IJSRuntime jsRuntime, ElementReference element)
{
return jsRuntime.InvokeVoid("BitBlazorUI.BitExtras.goToTop", element);
return jsRuntime.InvokeVoid("BitBlazorUI.Extras.goToTop", element);
}

internal static ValueTask BitExtrasScrollBy(this IJSRuntime jsRuntime, ElementReference element, decimal x, decimal y)
{
return jsRuntime.InvokeVoid("BitBlazorUI.BitExtras.scrollBy", element, x, y);
return jsRuntime.InvokeVoid("BitBlazorUI.Extras.scrollBy", element, x, y);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
namespace BitBlazorUI {
export class BitExtras {
export class Extras {
public static applyRootClasses(cssClasses: string[], cssVariables: any) {
cssClasses?.forEach(c => document.documentElement.classList.add(c));
Object.keys(cssVariables).forEach(key => document.documentElement.style.setProperty(key, cssVariables[key]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public override int SaveChanges(bool acceptAllChangesOnSuccess)
{
try
{
PropagateConcurrencyStampValue();
//#if (database != "Sqlite")
ReplaceOriginalConcurrencyStamp();
//#endif

return base.SaveChanges(acceptAllChangesOnSuccess);
}
Expand All @@ -63,7 +65,9 @@ public override int SaveChanges(bool acceptAllChangesOnSuccess)
{
try
{
PropagateConcurrencyStampValue();
//#if (database != "Sqlite")
ReplaceOriginalConcurrencyStamp();
//#endif

return await base.SaveChangesAsync(acceptAllChangesOnSuccess, cancellationToken);
}
Expand All @@ -73,11 +77,16 @@ public override int SaveChanges(bool acceptAllChangesOnSuccess)
}
}

//#if (database != "Sqlite")
/// <summary>
/// https://github.com/dotnet/efcore/issues/35443
/// </summary>
private void PropagateConcurrencyStampValue()
private void ReplaceOriginalConcurrencyStamp()
{
//#if (IsInsideProjectTemplate == true)
if (Database.ProviderName!.EndsWith("Sqlite", StringComparison.InvariantCulture))
return;
//#endif
ChangeTracker.DetectChanges();

foreach (var entityEntry in ChangeTracker.Entries().Where(e => e.State is EntityState.Modified))
Expand All @@ -89,6 +98,7 @@ private void PropagateConcurrencyStampValue()
entityEntry.OriginalValues.SetValues(new Dictionary<string, object> { { "ConcurrencyStamp", currentConcurrencyStamp } });
}
}
//#endif

protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
Expand Down

0 comments on commit a8b9ccc

Please sign in to comment.