[Persistence] data doesn't get fetched in use until I trigger an action (entity.set())
See original GitHub issueDescribe the bug
In order to try this out, I set up a simple todo list on Codesandbox.io. Everything worked fine until I introduce the persistence
plugin. It doesn’t fetch the persisted state when the component mounts unless I trigger the entity.set()
function.
To Reproduce Steps to reproduce the behaviour:
- link to a sandbox to demonstrate this: https://codesandbox.io/s/loving-worker-vei0p?file=/src/App.tsx
- add a couple of todos from the input field
- click reload in the codesandbox mini browser, only the initial state will show up.
Expected behaviour todo items are supposed to be fetched when components mounts (on load)
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Refresh and fetch an entity after save (JPA/Spring Data ...
Use Refresh directly in SomethingResource (Assuming Something is an ... EAGER , the entity should have the property attribute initialized.
Read more >Hibernate's persist(), save(), merge() and update()
You can use the methods persist and save to store a new entity and the methods merge and update to store the changes...
Read more >Querying JPA Entities with JPQL and Native SQL - Oracle
Learn how to take advantage of the Java Persistence query language and native SQL when querying over JPA entities. In Java EE, the...
Read more >Redux Essentials, Part 8: RTK Query Advanced Patterns
RTK Query allows multiple components to subscribe to the same data, and will ensure that each unique set of data is only fetched...
Read more >Hibernate ORM 6.1.6.Final User Guide - Red Hat on GitHub
Basic collection mapping; 2.2.44. ... Dynamic fetching via Jakarta Persistence entity graph ... Use Hibernate and report any bugs or issues you find....
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
I ran some open-source tests that were originally meant to test state managers in Concurrent Mode, but it also measures execution times. Happy to report these positive results:
All figures are execution times in milliseconds (lower is better)
| External Events | Transition | Auto Increment – | – | – | – SimpleR State | 2885 | 2319 | 2746 React-redux | 3231 | 2335 | 3143 Redux + use-mutable-source | 3286 | 2403 | 3225 Recoil | 3209 | 2562 * | 3105 Use-subscription | 3205 | 2413 | 3242 Zustand | 3178 | 2340 | 3126 Jotai | 3210 | 2429 | 3230 Valtio | 3217 | 2338 | 3305 React Sweet State | 4180 | 3276 | 3150 Effector | 4174 | 3140 | 3104
(*) Recoil failed the transition test for some reason tests were based on: https://github.com/dai-shi/will-this-react-global-state-work-in-concurrent-mode
So SimpleR State is not only developer-friendly, but also superlatively fast. I don’t really like comparing with other libraries out there, especially the “giants”—it simply wasn’t the goal of the library—but since someone asked… 🤣
Yesterday, I held a workshop where I shared simpler-state with my community. They really share the same excitement as I do. However, someone asked me a very valid question;