These are chat archives for jquense/react-widgets

27th
Aug 2016
Soren Peterson
@SorenPeterson
Aug 27 2016 02:39
Hello, I am trying to use a calendar with server side rendering, and I am getting a message that says the checksum was invalid. I tracked it down to be the calendar label button. I was reading the source code and found this line: var viewID = (0, _widgetHelpers.instanceId)(this, '_calendar')
Will someone help me understand what this line does? What is this syntax?
bundle.js:1316 Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:
(client) ton><button id="rw_1_calendar_label" ari (server) ton><button id="rw_16_calendar_label" ar
Soren Peterson
@SorenPeterson
Aug 27 2016 02:56
@here Ok. So I found the offending line. In util/_.js, there is an idCount variable. The uniqueId function increments that variable every time a new id is requested. I am currently looking into how it would be possible to reset this idCount upon rerendering.
Soren Peterson
@SorenPeterson
Aug 27 2016 03:18
One though I had was forcing react-widgets to reload every time you want to render, but that seems terribly inefficient.
Soren Peterson
@SorenPeterson
Aug 27 2016 03:37
Ok. So here's what I did to resolve my problem. I added a function to the lib/utils/_.js file called resetIdCount. All it does is set idCount to 0. It was enough to solve my problem. I'll open a pull request, but I would be more than happy to discuss alternative solutions.