typeahead: constant dropdown items re-rendering
See original GitHub issueOn the demo site the whole suggestion list for typeahead gets re-rendered on any event. For example on arrow up, arrow down, hovering mouse over items, etc.
I would expect only the active
css class to change
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
reactJS | antd | Facing issue in sustaining selection on re ...
I am trying to dispatch an action onSelect of a component to populate another dropdown. I have used onSelect event-handler to achieve that ......
Read more >How to rerender dropdown after the entire select's HTML was ...
Hi, I have some <select> elements on my page, which are decorated with the kendoDropDownList widget. The problem is, that their content can ......
Read more >How to Save State to LocalStorage & Persist on Refresh with ...
Fortunately we have some options for we can layer storage on top of React State and keep those values around for as long...
Read more >3 Ways to Render Large Lists in Angular - Bits and Pieces
We're rendering 500 items at once, and the rendering happens outside of the container boundaries. Some issues may arise with the container ...
Read more >React useReducer Hook ultimate guide - LogRocket Blog
While Redux, Recoil, and MobX are usually the best options for managing global state in large React applications, more often than necessary, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Basewq I just tested it and this removes both excessive rendering and
(click)
issues inside the template. Indeed, looks like the issue was doingnew ResultTplCtx()
each time. Simple enough fix for me, thanks! Opened a pull request.I think the issue can be solved by inlining the ngOutletContext object in typeahead-window, ie.
<template [ngTemplateOutlet]="resultTemplate || rt" [ngOutletContext]="_prepareTplCtx(result)"></template>
to<template [ngTemplateOutlet]="resultTemplate || rt" [ngOutletContext]="{result:result, term: term, formatter: formatter}"></template>
Excuse the messy plunker: https://plnkr.co/edit/yHFIDu7xKhISlGzoDY39?p=preview I tested changing the line in file src/typeaheadwin.ts and it seems to stop the rerendering on mouse events.
Can someone test this is the case?
If this is indeed the fix, can we try reverting back the mousedown event to click (#527), as most people expect the selection to occur on mouse up, as I think the mouse event issue was caused by some sort of race condition with the re-rendered template.