The "update" event gets triggered before "mount" #1661

Closed
GianlucaGuarini opened this Issue Mar 7, 2016 · 10 comments

Projects

None yet

4 participants

@GianlucaGuarini GianlucaGuarini added the bug label Mar 7, 2016
@GianlucaGuarini GianlucaGuarini added this to the 3.0.0 milestone Mar 10, 2016
@GianlucaGuarini
Member

this will be a breaking change and it will be introduced in riot 3.0.0

@believer-ufa

Gianluca, can you tell where is i can read about Riot.js 3.0? Sorry for offtop.

@GianlucaGuarini
Member

You can check the commits on the next branch.
You can try it using npm install riot@next
And you can read our discussions on any pull request on the next branch

This was referenced Mar 16, 2016
@rogueg
Member
rogueg commented Apr 17, 2016

I was also confused by this behavior at first, but having looked at the code it now makes more sense. What do you think the behavior should be?

@GianlucaGuarini
Member

@rogueg the update/updated events will be triggered only after the tag will have the isMounted flag to true

@GianlucaGuarini
Member

http://plnkr.co/edit/EWLe1kGsJTlW6G8XcwjA?p=preview no even if we check the isMounted flag the problem still exists

@rogueg
Member
rogueg commented Apr 17, 2016

I should add a comment to that line. It's intent is to prevent updates
after unmount, not before mount.

Having update happen before mount means that when the DOM gets inserted,
it's all ready and won't need to be modified any more. My gut says that's
better for performance, but we could test it.

On Sunday, April 17, 2016, Gianluca Guarini notifications@github.com
wrote:

@rogueg https://github.com/rogueg the update/updated events will be
triggered only after the tag will have the isMounted flag to true


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#1661 (comment)

@GianlucaGuarini
Member

@rogueg I have fixed the issue ;) my patch was enough ff2afc1

@rvion
rvion commented Apr 18, 2016 edited

my app is ~1.5/1.6 time faster to load now, perfect !
edit: the updated event doesn't seem to be triggered anymore after mount.

@fabien fabien referenced this issue Oct 28, 2016
Closed

Tag in Node/SSR does not handle events correctly #2045

1 of 7 tasks complete
@GianlucaGuarini GianlucaGuarini added a commit that closed this issue Nov 22, 2016
@GianlucaGuarini GianlucaGuarini closes #1661 ff2afc1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment