I ran into a bit of an issue today while trying to render multiple instances of a component on a single page. Each component had a file input that was bound with an onChange event. When triggered the onChange function referenced the first component placed on the page no matter which instance was clicked.
The issue ended up being that the id of the input fields coincidentally overlapped. This meant that there were multiple instances of the field on the page with the same id value. Ensuring that each one was unique resolved the issue.
Took a fair while to narrow this one down so hopefully it’ll be able to help someone else!
Bit of a silly error I ran into today. This one took an embarrassingly long time to figure out unfortunately:
index.js:2178 Warning: A component is changing an uncontrolled input of type checkbox to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://fb.me/react-controlled-components
It turned out that the error was a result of not having added the state variable in the constructor. It was then being created onChange and converting the input element into a controlled input.
I was trying to use a checkbox in my form and had copied the input from another view:
A team member found an interesting bug today that caused chrome to go non-responsive. The cause was simply dragging a file from the file explorer onto a drag and drop upload area. It is reproducible on every site I’ve tested, including Gmail and Dropbox.
Go to https://mail.google.com
Click attach files (close any of the annoying popups that appear)
DRAG a number of files from the file selector window to the new message screen (they will start to upload) (IMPORTANT: these need to be dragged from the file selector popup, NOT a new explorer window)
While they are still uploading hit cancel on the file browser window. Browser will go non-responsive
I was having a bit of trouble with CarrierWave on Amazon S3 today. When attempting to upload files that were larger than ~150kb I received one of the following errors (depending on config):
getaddrinfo: Name or service not known carrierwave
Excon::Errors::SocketError in PhotosController#create
Broken pipe (Errno::EPIPE)
Despite the vague error, the solution was fairly simple. The region configured in my initialiser was different to the one my bucket was created in.
In order to find out which region you need, logon to your AWS console and browse to an uploaded image. Check the endpoint URL (properties > static website hosting) and simply copy the region. For examples:
Thanks to this stackoverflow post I realised that the data wasn’t being serialised because I’d disabled most of the fields beforehand. This was done in order to prevent the user from changing the values. To get around this I simply had to serialise the data BEFORE disabling anything.
Just a quick post on how to block duplicate payments with PayPal. All you have to do is pass an invoice parameter and then select the ‘block multiple payments per invoice ID’ option in PayPal. I’ve attached an extract from PayPal’s documentation below:
1. Login at https://www.paypal.com
2. Click the ‘Profile’ subtab
3. Under ‘Selling Preferences’ click ‘Payment Receiving Preferences’
4. Choose ‘Yes, block multiple payments per invoice ID’ if you wish to utilize this feature while passing the “invoice” variable
5. Scroll to the bottom and click the ‘Save’ button
To pass the invoice number for Website Payments Standard, you will need to add a line of code to your existing button code. You cannot add this code to a button originally created as encrypted. Example below: