question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

server side slider component

See original GitHub issue

I have a question about implementation details of a slider component. Let say i have a code like

<div class="form-group"><label for="creditCardDebt" class="main__form-label">Credit Card Debt</label> <span> @ApplyFormModel.Debt.ToString("C") </span> <input type="range" min="0" max="30000" step="1000" id="creditCardDebt" class="form-control" @bind="@ApplyFormModel.Debt" @bind:event="oninput" /></div>

So when using Blazor server side every time i move a slider to another position i see a request to the server. Could it be a potential performance issue? Any best practices on how to implement such use case in a different manner? Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mselinger75commented, Jan 22, 2020

thanks. i have already tried to use OnAfterRenderAsync and it worked just fine even without StateHasChanged call at all

protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender == false) { if (ShowErrors) await JsRuntime.ScrollToElementId(“div-errors”); } }

0reactions
yopez83commented, Jan 22, 2020

my question though - how can i make sure that call to StateHasChanged re-renders component fast enough so by the time JsRuntime.ScrollToElementId executes my errors div already in place?

For more details on the Blazor Components Lifecycle click here. To answer your question, I’d override the OnAfterRenderAsync() and make the call to scroll there. Remember the call to StateHasChanged() should happens in the method you are making a request to the server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Slider | Server-Side Components | Framework
The Slider is a vertical or horizontal bar that allows setting a numeric value within a defined range by dragging a bar handle...
Read more >
Slider component
The v-slider component can be used as an alternative visualization instead of a number input. #Usage. Sliders reflect a range of values along...
Read more >
QuickStart | Vue Slider Component
Server -Side Rendering (SSR). Because the default imported file has inline styles, direct use will cause an error ( document is not defined...
Read more >
React slider tutorial using react-slider
Learn how to create different sliders using react-slider, a React headless component that's easy to build and customize.
Read more >
react-multi-carousel
Production-ready, lightweight fully customizable React carousel component that rocks supports multiple items and SSR(Server-side rendering).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found