Fix SSR issues with SortableJS 1.10.0 #723
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SortableJS 1.10.0 has been release 2 days ago and break some SSR things.
![image](https://user-images.githubusercontent.com/1301995/65084589-ecfab880-d9ab-11e9-8c1a-d8df520a2558.png)
Before 1.10.0 : Every "navigator.useragent"/"typeof window" check was not done on the module import.
Now : When you import sortable it does some client only check :
So the only solution is too import Sortable only on the client side (Like in this PR).
Is this solution really ugly ? I'm not 100 % sure, but the only place this plugin use the
Sortable
constructor is on themounted
hook, and this hook in SSR is only called on client side (https://ssr.vuejs.org/guide/universal.html) so it will have the module included.