`oncreate` vs `onupdate`
See original GitHub issueI noticed that onupdate
doesn’t fire during the first update, is this intentional?
I think, in most systems that offer both a create and update notification, the initial creation triggers both a create and an update notification, because there isn’t typically much use for an update notification that doesn’t fire the first time.
Typically the notifications you need are for creation, for destruction, or for all updates - rarely does anyone need a notification for “all updates except the first one”.
Thoughts?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:45 (41 by maintainers)
Top Results From Across the Web
How to make Function trigger only onCreate and onUpdate?
onCreate Triggered when a document is written to for the first time. onUpdate Triggered when a document already exists and has any value....
Read more >Cloud Firestore triggers | Cloud Functions for Firebase
Triggered when onCreate , onUpdate or onDelete is triggered. Note: Cloud Firestore events will trigger only on document changes. An update to a...
Read more >onUpdate (and onCreate) function triggered when document ...
Result: logs show both onCreate and onUpdate are called. The outcome of the equivalent Node app seems to be correct. Only onCreate called...
Read more >Entity behaviors - Events - Cycle ORM
OnCreate ; OnUpdate; OnDelete; QueueCommand. The package dispatch several events, allowing you to hook into the following moments in an entity's lifecycle:.
Read more >Lifecycle methods - Mithril.js
Usage · The DOM element lifecycle · oninit · oncreate · onupdate · onbeforeremove · onremove · onbeforeupdate.
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 Free
Top 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
By no means “there” yet, and I have to quit for today, but I did make some interesting progress.
https://jsfiddle.net/mindplay/o2rdL259/4/
I’ve extended the
h
function so I can test iftype
is a constructor that extendsComponent
- right now it’s recreating the component on every iteration, but so far so good. Next step is to try to inject the component instance into a reserved field inprops
, and make it carry over viaoldProps
, which should be possible by proxyingoncreate
andonupdate
.The sample class here illustrates what I’m trying to do - I think that class-based components do make sense here - you’d be able to encapsulate the model and the render function into a self-sufficient, reusable component. It’s not exactly the React approach, as I’m putting the component itself in charge of managing it’s own state and calling
Component.invalidate()
to re-render. We’ll see if this pans out… 😃Or we could leave things the way they are.