The first is the bug with expanding preview images. This is caused by an overeager shouldComponentUpdate on line 54 of the Gallery component (static/src/js/components/Gallery/Gallery.jsx). It's telling the component not to update unless the props.mediaFiles array is changed. Clicking the image changes state.selected, which works correctly, but the shouldComponentUpdate tells React not to change the page in response. The workaround (clicking the mod title after clicking the thumbnail) only works because of another bug. The shouldComponentUpdate is testing the props.mediaFiles array for object identity, not content equality. When the mod title is clicked, the props are updated with a different array object with the exact same contents, so the !== returns true even though the array contents are the same.
The best fix is to delete shouldComponentUpdate from the Gallery component. As far as I can tell, there's nothing in the props or state that would slow down the default shouldComponentUpdate, which does deep equality checks, enough to make it worth implementing your own. If I missed something, and you do need to implement your own, it should (a) check the state as well as the props (the new state is passed as the second argument, and is used the same way as the new props), and (b) check content equality on props.mediaFiles instead of object identity.
The second bug is with NaN dates in Safari. This happens because the format of the datetime string received from the server is nearly compliant with the Javascript spec, but it differs in that a space character is used to separate the date and time instead of the spec-mandated 'T'. Whether or not browsers accept a format other than the ones defined by the spec is implementation-defined. Chrome does, Safari doesn't.
The simple fix is to replace the space with a 'T' in the date string before passing it to new Date(). In /static/src/js/lib/utils.js, replace line 30 (the first line of the timeAgo function) with this line:
Code: Select all
var then = (new Date(date.replace(' ', 'T')).valueOf()