Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Turbolinks unmount event from before-visit to before-render #709

Merged
merged 10 commits into from
Feb 11, 2017
Merged

Change Turbolinks unmount event from before-visit to before-render #709

merged 10 commits into from
Feb 11, 2017

Conversation

szyablitsky
Copy link
Contributor

@szyablitsky szyablitsky commented Feb 8, 2017

fixes #706


This change is Reviewable

@coveralls
Copy link

coveralls commented Feb 8, 2017

Coverage Status

Coverage remained the same at 99.329% when pulling 666237a on szyablitsky:master into 75cf810 on shakacode:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.329% when pulling 9125420 on szyablitsky:master into 75cf810 on shakacode:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.329% when pulling 9125420 on szyablitsky:master into 75cf810 on shakacode:master.

@justin808
Copy link
Member

@volkanunsal @szyablitsky Do we have consensus on merging this one?

@justin808
Copy link
Member

:lgtm:


Reviewed 2 of 2 files at r1, 1 of 1 files at r2.
Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@szyablitsky szyablitsky changed the title Change Turbolinks unmount event from before-visit to before-render Add an option to change Turbolinks unmount event from before-visit to before-render Feb 9, 2017
@volkanunsal
Copy link
Contributor

Looks good to me. 👍

@justin808
Copy link
Member

Imagine I have to explain this to a beginner or in an insturctional video. What do I say? That needs to go in the docs.

@szyablitsky
Copy link
Contributor Author

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.329% when pulling 6feb067 on szyablitsky:master into 75cf810 on shakacode:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.329% when pulling 6feb067 on szyablitsky:master into 75cf810 on shakacode:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.329% when pulling 6feb067 on szyablitsky:master into 75cf810 on shakacode:master.

@coveralls
Copy link

coveralls commented Feb 10, 2017

Coverage Status

Coverage remained the same at 99.329% when pulling 284c096 on szyablitsky:master into 75cf810 on shakacode:master.

@justin808
Copy link
Member

A few comments...

My main concern is that this may not need to be configurable. I'm not convinced on why the default should be one way or another and why you'd change it.

We should provide a thorough explanation here:
https://github.com/shakacode/react_on_rails/blob/master/docs/additional-reading/turbolinks.md


Reviewed 4 of 6 files at r3, 2 of 2 files at r4.
Review status: all files reviewed at latest revision, 5 unresolved discussions.


CHANGELOG.md, line 9 at r4 (raw file):

*Please add entries here for your pull requests.*
### Added
- Added an option to change Turbolinks unmount event from `before-visit` to `before-render`. To allow fixing "flickering" components when they are unmounted too early [#709](https://github.com/shakacode/react_on_rails/pull/709) by [szyablitsky](https://github.com/szyablitsky)

Please reference the github "issue" as well.


docs/additional-reading/turbolinks.md, line 102 at r4 (raw file):

## Unmount event
By default Turbolinks 5 will handle `turbolinks:before-visit` event for unmounting rendered components before visiting next page. If you use the same component on different pages this can cause the temporary disappearance of component during page load and even moving the parts of the page. To fix this issue switch unmount event to `turbolinks:before-render`.

@volkanunsal @szyablitsky What is the disadvantage to always using before-render? Why did we change this to before-visit?


docs/additional-reading/turbolinks.md, line 102 at r4 (raw file):

To fix this issue switch unmount event to turbolinks:before-render.
To fix this issue set the client side option turbolinksUnmountOnBeforeRender to true.


docs/api/javascript-api.md, line 37 at r4 (raw file):

   * Available Options:
   * `traceTurbolinks: true|false Gives you debugging messages on Turbolinks events
   * `turbolinksUnmountOnBeforeRender: true|false Binds unmount to before-render event

true binds unmounting to the before-render event, false keeps the default behavior of before-visit


node_package/src/ReactOnRails.js, line 62 at r4 (raw file):

   * Available Options:
   * `traceTurbolinks: true|false Gives you debugging messages on Turbolinks events
   * `turbolinksUnmountOnBeforeRender: true|false Binds unmount to before-render event

true binds unmounting to the before-render event, false keeps the default behavior of before-visit


Comments from Reviewable

@szyablitsky szyablitsky changed the title Add an option to change Turbolinks unmount event from before-visit to before-render Change Turbolinks unmount event from before-visit to before-render Feb 10, 2017
@coveralls
Copy link

coveralls commented Feb 10, 2017

Coverage Status

Coverage remained the same at 99.329% when pulling 052b662 on szyablitsky:master into 75cf810 on shakacode:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.329% when pulling 052b662 on szyablitsky:master into 75cf810 on shakacode:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.329% when pulling 052b662 on szyablitsky:master into 75cf810 on shakacode:master.

@szyablitsky
Copy link
Contributor Author

Removed option and set unmount event back to turbolinks:before-render.

@justin808
Copy link
Member

@volkanunsal Are you good with this change? I'd prefer not to have an extra option if it's not necessary.

@volkanunsal
Copy link
Contributor

volkanunsal commented Feb 10, 2017 via email

@volkanunsal
Copy link
Contributor

I'm ok with removing the configuration option.

@justin808
Copy link
Member

:lgtm:


Reviewed 5 of 6 files at r5.
Review status: all files reviewed at latest revision, 5 unresolved discussions.


Comments from Reviewable

@justin808 justin808 merged commit 7ad5c13 into shakacode:master Feb 11, 2017
@justin808
Copy link
Member

Fixed in 6.5.1.

justin808 pushed a commit that referenced this pull request Feb 11, 2017
)

* change turbolinks unmount event from before-visit to before-render
* Addresses #706
justin808 added a commit that referenced this pull request Feb 11, 2017
…e-redux-div-to-json-script

* origin/master: (42 commits)
  Release 6.5.1
  Update CHANGELOG.md
  Ability to work without sprockets (#671)
  Change Turbolinks unmount event from before-visit to before-render (#709)
  Update generator.md
  Update README.md
  Update i18n.md
  Small formatting tweak
  Release 6.5.0
  Updated CHANGELOG.md
  Update README.md
  Update README.md
  Update README.md
  Fix incorrect "this" references of Node.js SSR
  Remove reference to heroku-buildpack-multi (#698)
  Small fixes to achieve reproducible build (#661)
  Update PROJECTS.md
  Doc Changes for links on gitbook
  Update README.md
  Added property renderedHtml to return gen func
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using turbolinks:before-visit causes too early unmount and components "flickering"
4 participants