This is the second time I am experiencing this. When you ‘Duplicate’ a page the code on the page runs twice. Which means if I’m submitting a form, the form is inserted 2 times into the database and a confirmation email is sent twice.
Last time (when I did not raise this issue) the page was charging a credit card twice via Stripe (Live Environment) and creating 2 orders, I did not report this because there was more than 1500 lines of code and I thought it was my mistake somewhere but now I am sure this is a bug.
Can someone from the team please take a look at the page where it is occurring.
@shantanukumar847 I didn’t say it’s not like that, but it’s a quite unusual bug. Anyway, since it happened twice, and in your case it’s very painful, maybe you should add some code to deal with such bugs (for example to add a click timestamp and reject collection records if the timestamp is not unique).
Hey Shah, I see that you are not exactly swamped by response and I know how frustating that can be, been there.
Do you have a short proof-of-concept version that I can try out? Or should I make one myself (for nobody is going to look thru 1500 lines of code). Could you give me a few pointers, like:
is it a dynamic page or not (think last, since dynamics can´t be copied, but see 3)
you use a dataset or data-insert
what is your page renaming convention or do you copy across projects
do you use any db-hooks (like onBefore/AfterInsert on db level, so not in code
We need more information in order to evaluate this issue. Please provide site URLs, indicate which site page is encountering the problem, and what was the original page that was duplicated.
The place where the code runs twice: [REMOVED]
The original page: [REMOVED]
Also, this is not confined to one particular site as its happening on all the sites I work with. To explain to you better I have made the following video.
P.S. Even if I change the Page’s URL or name it still does not solve the issue.
@shantanukumar847 Hey shan, I’m playing with this and so far I don’t see the problem. I created a page, with a button, and a console.log() - just like you did. It works fine - the console.log() output appears once per button click.
@yisrael-wix Actually I found out about the problem when Stripe charged a user’s card twice for a single purchase. The user was from Spain using a mobile device.
After this I have run tests on my Windows 10 Laptop, Android Mobile, Android Tablet, MAC, Windows 8.1 Laptop but its the same everywhere.
However I will try to have another kind of beer and let you know.
P.S. In the meantime if you find out anything more about this then please let me know.
Well, of course, this is a feature. What? You don’t want the duplicated button to be connected to both the old and new event handlers? Hmm.
The smart people in QA have verified that your suspicions are correct and that the duplicated page does in fact maintain the connections to the event handlers on the original page. They’ve opened up a ticket on this.
Meanwhile, a workaround for this is to disconnect the component on the duplicated page from its event handler (which ends up disconnecting the old event handler as well), and then connect it again to its event handler on the new page. Do this for all affected components.