UI block while rendering data in ReactJs - javascript

I have a side bar and a container when i click on any link on side bar the container loads its component and renders its data.
on clicking sidebar links there is an animation happen on side bar which stuck when data being rendered i figured out while rendering all UI stop responding for some milliseconds how to solve these type of problems any help ???
I have tried using React.Memo() to optimize rendering but none work i thought its single threaded issue but dont know how to solve it
See Animation Stuck when data being Rendered

Related

Doing a complex translation animation in React (Next.js) while route changes

I have been trying to do a complex (for me at least) animation in react for a week and I am still unable to do it. I have attached the ss of a minimalist demo I made up in figma because I cannot share the actual design file.
I am using Next.js and I have to trigger this animation when the route changes (which happens automatically).
I have so far been using react-spring with its useTranslate hook. With this hook, I can use a state change to trigger the animation and also unmount the component at the end of it. For me the, automatic redirect happens after a state change that is coming from the backend via a subscription. I am hoping to use that to trigger the animation.
I am logically dividing this animation into two parts:
First part is the background gradient fading out along with the list while the avatars is fading in. This happens all the same time.
The cards duplicating behind it's back and slowly translating downwards and fading out.
So far I have figured out:
How to simultaneously trigger the animations. This is easy as I can pass the same state to different useTranslate hook with the same config object and the animations can be triggered at the same time and lasted the same duration.
How to trigger the opacity animation which can fade the avatars in while fading out the list.
But I am yet to figure out how:
To fade out background like that.
Duplicate the cards one behind another and then slowly translating them down. Not sure how to target each individual cards either.
Actually chain these animations so I can trigger the second one after the first.
Has anyone ever dealt with these kind of situations? Any other option than react-spring? Is it possible or easier if I use SVGs? Any piece of advice would be great.
Link to ss

onMouseLeave - gauge chart component size increases

I am facing an issue with the react-gauge-chart library in my react project.
I have implemented a popover component using material-ui and introduced the gauge chart component from the library inside the popover modal. On text hover gauge chart is been displayed correctly but during onmouseleave event, the popover component flicks(size of gauge chart increases) for a tiny bit second then closes the popover modal. This flicker is currently effecting our project UI.
When I test without the gaugechart there is no issue with the onmouseleave event. Could anyone please help me where am I going wrong here or a solution which I can use?
As I am new to CSS I am not able to understand where this issue is coming from.
Reproduced the issue here
https://codesandbox.io/s/react-over-issue-5ibv6
Thanks
The onmouseleave event is not the cause of this problem. If you change toggling popups to click you continue to get this behavior
This is a rendering issue. When the popup is closed, the content size is decreased and this causes this behavior

Panels disappearing after 1~2 secs using dojo framework

I am using dojo to render the panels on UI. I am facing one issue. All the panels get rendered on UI for few seconds(around 1~2 secs). After that I am getting a blank white screen. Now if I want to see the panels I've to do dragging the splitter OR maximize/restore that pane. I.e. basically I need to play with the width so as to get back the disappeared panels.Please suggest some solutions over this.
It would be better if you can provide more information in your question, your code is better. Otherwise, it is hard to tell what exactly cause this issue.
But you can try add resize call of the container of your panels somewhere after you startup this container.

jQuery Accordion Shrinks Google Charts if not in First Tab

I have a few different Google Charts that i want to put inside the sections of a jQuery accordion. The problem is that all the charts that are not inside the first part of the accordion are smaller for some reason. Something about the accordion is shrinking these charts. I do not want them to shrink. Does anyone know what I can do to keep them from shrinking?
See this example which illustrates the problem: http://jsfiddle.net/dN3LL/
Thanks!
EDIT
So from the answer provided by brandwaffle, I considered that the graphics should render before the divs are collapsed into accordion form, so I simply put the $('#accordion').accordion(); line right after the graphs are finished rendering, and it works! See the fiddle: http://jsfiddle.net/dN3LL/4/
I've had this happen to me with various different pieces of content in the past. I think the problem happens because the content is rendered in a collapsed container, so it defaults to the smallest possible size (I've seen this with content in flexible-width divs inside of the accordion as well). The best solution I can offer for an across-the-board resolution is to hook whatever google chart generation (or other content display) to the accordionchange event that jQueryUI's Accordion offers: http://jqueryui.com/demos/accordion/
If you use the accordionchange event, the Google Chart will render itself after the accordion has switched to the correct section, which should eliminate any problems you're having as a result of the chart trying to render into a squished (i.e. unopened) container. There may be a better CSS fix for this, but I haven't found one yet.
one workaround is, load chart first and then run accordion code once chart load complete or run accordion code after 1-2 sec (setTimeout)

How to keep on adding/showing items on my page while scrolling the vertical bar

Thanks a lot for all ur supports...Now I've a problem to resolve..I want to scroll the vertical bar and show the items in the page to appear as the scroll will go down(the way it happens in facebook page..It keeps on adding lists,items,comments,images as u keep on dragging the vertical scroll bar down)...Right now I don't have any code segment to use..and I've least idea regarding this..Please help me out..Preferable language/script could be asp.net,html,javascript,css,C# as I don't have any knowledge on PHP and MySQL..
This is called infinite or continuous scrolling, and it's mostly done in combination with jQuery.You can find some links below - though i couldn't find a working demo (and i know nothing about asp.net).
http://www.eggheadcafe.com/tutorials/asp-net/b8381915-06d9-4538-b4bb-5ac2a8e73f34/implementing-continuous-scrolling-ui-pattern-in-aspnet.aspx
http://weedallaboutit.wordpress.com/2011/10/13/infinite-scrolling-with-an-asp-net-webform-jquery-and-a-little-bit-of-code/
http://studentguru.gr/b/xinarisc/archive/2011/05/29/infinite-scrolling-with-jquery-amp-asp-net.aspx

Categories