It's too difficult to depend on library users to know that they are calling javascript_pack_tag
and stylesheet_pack_tag
only once during the rendering cycle.
This is extremely deadly when using React as you get error like:
Original message: Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)
Or other vague errors with React indicating that maybe multiple copies of react are included.
We have 2 ways to fix this:
Logger.warn
could also be done.Important: Pass all your pack names as multiple arguments, not multiple calls, when using javascript_pack_tag
and the stylesheet_pack_tag
. Otherwise, you will
get duplicated chunks on the page. Be especially careful if you might be calling these view helpers from your view, partials, and the layout for a page. You will need some logic to ensure you call the helpers only once with multiple arguments.
<%# DO %> <%= javascript_pack_tag 'calendar', 'map' %> <%= stylesheet_pack_tag 'calendar', 'map' %> <%# DON'T %> <%= javascript_pack_tag 'calendar' %> <%= javascript_pack_tag 'map' %> <%= stylesheet_pack_tag 'calendar' %> <%= stylesheet_pack_tag 'map' %>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4