Items is [] when the component refreshes
See original GitHub issueIt seems that when you mount/unmount the component and the itemCount
does not change the items
is [] (after the first time).
A hacky way out of it is to do something like itemCount: myCount + Math.round(Math.random() * 100)
and filter later.
In other words, some kind of check takes place based on the itemCount
that causes cache-related (I presume) issues.
Issue Analytics
- State:
- Created 2 years ago
- Comments:37 (19 by maintainers)
Top Results From Across the Web
Loosing component data on page refresh in react
... app starts (when you press F5, the page is refreshed, your React app is restarted so it loses all components states, contexts,...
Read more >How to Refresh a Page or Component in React - Upmostly
The first way of refreshing a page or component is to use vanilla JavaScript to call the reload method to tell the browser...
Read more >force:refreshView - Salesforce Lightning Component Library
To refresh a view, run $A.get('e.force:refreshView').fire(); , which reloads data for standard components. Custom components are refreshed with known ...
Read more >Save State to LocalStorage & Persist on Refresh with React.js
Learn how to save React state and load it when a page refreshes using localStorage. We'll learn how to set up a simple...
Read more >How to Save State to LocalStorage & Persist on Refresh with ...
React's state APIs give developers great ways to maintain personalization or the items you have in your shopping cart, but once you refresh...
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
@wellyshen Will try to make some time to do it later.
Hai @wellyshen first things first I want to thankfull for the library.
I Had similiar issue with this. After successfull render the components, I move to other pages and back to the components, data wont to render it’s because
isItemLoadedArr[loadIndex] = true
.So I used to
const [isItemLoadedArr, setIItemLoadedArr] = useState([]);
create useEffectpass
isItemLoadedArr
toloadMore: (e) => loadData(e, setActivities, isItemLoadedArr)
and the last things passisItemLoadedArr
toconst loadData = async ({ loadIndex }, setActivities, isItemLoadedArr) => {...};
This also avoid the callback from being invoked repeatedly.
This is my full code:
Hope it’s help, thank you.