Error: Can't collect styles once you've called getStyleTags!
See original GitHub issueI am using this component "styled-components": "^2.1.1"
in my VulcanJS app
This code is a server-side code:
import { ServerStyleSheet } from 'styled-components';
I am using the following code in my app
const sheet = new ServerStyleSheet();
console.log(sheet.getStyleTags())
sheet.getStyleTags()
is generating the following error:
url: /
I20171025-11:02:07.279(5.5)? [Error: Can't collect styles once you've called getStyleTags!]
W20171025-11:02:07.292(5.5)? (STDERR) Wed Oct 25 2017 11:02:07 GMT+0530 (IST) 'error while server-rendering' 'Error: Can\'t collect styles once you\'ve called getStyleTags!\n at ServerStyleSheet.collectStyles (/home/deligence/1.Projects/Streetail/node_modules/styled-components/lib/models/ServerStyleSheet.js:116:28)\n at generateSSRData (packages/vulcan:routing/lib/server/router.jsx:58:35)\n at sendSSRHtml (packages/vulcan:routing/lib/server/router.jsx:87:45)\n at packages/vulcan:routing/lib/server/router.jsx:149:11\n at /home/deligence/1.Projects/Streetail/node_modules/react-router/lib/match.js:67:5\n at /home/deligence/1.Projects/Streetail/node_modules/react-router/lib/createTransitionManager.js:108:11\n at done (/home/deligence/1.Projects/Streetail/node_modules/react-router/lib/AsyncUtils.js:79:19)\n at /home/deligence/1.Projects/Streetail/node_modules/react-router/lib/AsyncUtils.js:85:7\n at getComponentsForRoute (/home/deligence/1.Projects/Streetail/node_modules/react-router/lib/getComponents.js:11:5)\n at /home/deligence/1.Projects/Streetail/node_modules/react-router/lib/getComponents.js:35:5'
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Can't change style : display using getelementbyclassname
Can't change style : display using getelementbyclassname · with getElementsByClassName you are getting HTMLCollection so try document.
Read more >Dynamic Styling Using the Element API - Vaadin
getStyle () : Gets the style instance to manage element inline styles. Using classLists and classNames. You can use the getClassList method to...
Read more >HTML DOM Style backgroundColor Property - W3Schools
The backgroundColor property sets or returns the background color of an element. See Also: HTML Styles: The background Property. CSS Tutorial: CSS Backgrounds....
Read more >.css() | jQuery API Documentation
The .css() method is a convenient way to get a computed style property from the first matched element, especially in light of the...
Read more >Use expressions to edit and access text properties
Edit text styles and text properties using expression controls. ... if style attributes from multiple text layers are being combined.
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
@kushalmahajan You have to create a new
ServerStyleSheet
on every rerender.Conceptually this is because internally we do store a lot of styles, but for each server-side render you only want the critical ones, the ones that have been used on the given component tree.
@kushalmahajan That is probably a mistake in your code. Can you please avoid posting on old issues and create a new one instead? 😉