Typing in selectors in Code area causes selector to be jumbled on save

Author Posts

rhkittredge

Hello,

When I choose an existing selector and go to the Code window to manually type in a selector (usually in addition to selectors that are already there), Microthemer jumbles the new selector I type on save. I have to try this several times before it will actually save the correct selector.

For example, a current selector might say:

.fl-rich-text li a:hover,
.mec-event-content li a:hover {

and I want to add a new selector:

.fl-rich-text li a:hover,
.mec-event-content li a:hover,
.uabb-infobox-content li a:hover {

however, when I exit MT, the selector turns into this:

.fl-rich-text li a:hover,
.mec-event-content li a:hover,
.uabb-info {

Is MT not able to handle multiple selectors or is this a bug?

I do not know if it is related but I also routinely get a error showing in MT that says “Uncaught TypeError: q.test is not a function (line 2)”.


Sebastian

Hey,

I’m so sorry for the slow reply, I wasn’t getting most forum notifications since switching laptop, so am catching up on everything now.

What you describe is a bug, MT should be able to handle comma separated selectors in the code editor just fine. I wasn’t able to replicate the problem you described which means:

a) It is specific to your WP setup, and maybe that q.test error is indeed relevant
b) I wasn’t doing it in the exact way you were

To see if it’s a general MT error, could you see if you can replicate it on the live demo? If you can, could you describe the steps in a bit more detail? And if you can’t, could you send me access to the affected site via our secure contact form so I can troubleshoot this for you?

Apologies again for the delay.

Cheers,
Sebastian


rhkittredge

Hi Sebastian,

I think I have found the issue and it does happen on your live demo as well. I tried this under Firefox and Edge (newest versions) and they both behave the same way.

I believe I tracked the issue down to backspacing. If you add a selector to an existing selector (in code view), but backspace a few times when typing the new selector (as in misspelling the selector, then backspacing to fix), MT will not save the whole selector name you just typed. Seems to lose the same # of characters as there were backspaces.


rhkittredge

I’ll add this too: seems to be easier to reproduce if you type in a long selector and backspace a few characters and retype. Almost every time I do that (although not 100% of the time), characters are dropped/lost in the new selector upon save.


Sebastian

Ah yes, I’ve managed to replicate the issue thanks to your instructions. I will try to roll out a fix for this today. I’ll write back soon.

Cheers,
Sebastian


Sebastian

OK, I think this might be because MT’s system for delaying page exit until its finished saving all data packets isn’t working anymore in Chrome, and maybe other browsers. I haven’t managed to settle on a good workaround today, but will hopefully come up with something by tomorrow.


rhkittredge

No worries at all. I’m just glad you were able to reproduce it and are looking at ways to fix it!

Note that I’m not sure if this is the same thing you’re referring to, but I thought maybe I was clicking Exit too fast after editing code and that’s why it wasn’t saving the whole selector I typed in. So I tried waiting a few seconds after it had said it was done saving, to see if the problem would resolve – and it didn’t seem to.


Sebastian

I think that’s actually part of the problem, the Saving settings notification can turn off a bit prematurely in the case of lots of rapid typing. When I check this with the Chrome dev tools Network tab open, I see requests firing off for longer than the Saving settings notification lasts.

It’s possible there is more to this, but I will address the incomplete save issue first, and then see if the problem still occurs.


rhkittredge

Understood. However, the problem only seems to rear its head when I backspace. If I get lucky and type a long selector correct the first time in my testing, the whole selector saves properly. It’s when I get ahead of myself and have to backspace that I see a problem. That seems like more of an editor problem than a saving problem but maybe not. Maybe your testing revealed it is not just backspace related.

Fwiw, I’m not trying to tell you how to fix the problem, lol. Just reiterating my experience.

Thanks for everything you’re doing!


Sebastian

Not at all, your input is much appreciated 🙂

The reason I had ruled out issues with the editor, is that I could never replicate the issue when simply switching back and forth between selectors. That reloads the data from a local JavaScript store, and it was always right. Even when reloading the page afterwards displayed the error (reloading the page involves pulling the settings saved in the database).

I still might be overlooking an issue with backspace, but I *think* I’ve fixed it. I identified a couple of issues specific to the action of editing selector code via the editor. The order of the save packets could get mixed up, and some functionality was invoked that generated lots of unnecessary ajax requests, which delayed the most relevant save request – the latest code in the editor.

If you could update to version 6.3.1.8 and try your best to trigger the error with backspace I would be very interested to hear your results. I can’t generate the error at my end with the latest changes, but I’m working on a brand new laptop that is very fast!

Thanks,
Sebastian


rhkittredge

I upgraded and indeed do not see this issue anymore. Nice work!

However on Firefox, I will occasionally get a white window that pops up in the middle of the browser window upon exit from MT. It flashes by so fast I can hardly read it. I managed to take a screenshot and here’s what it says: “Multiple tabs/users issue. MT settings were updated more recently by another user or browser tab. Saving from this outdated tab could cause data loss. Please reload the page instead of saving from this tab (to get the latest changes). true”

I have never seen this happen until upgrading to 6.3.1.8. I have no other browser tabs open that are editing this site. The changes I make are indeed saved correctly, it’s just this popup that flashes by in about a half second seemingly randomly.


Sebastian

Hey, thanks for alerting me to this. I’ve been playing around, and it seems to be specific to FireFox, and happens when the forward or back button is used to load MT. This loads a stale version of the page, which causes a false positive on the browser tabs warning.

I should be able to implement a workaround tomorrow, when I will have more time to test various solutions.


rhkittredge

Thanks. Your fix tomorrow may solve the Firefox issue, but the cause is not what you describe. At no time am I going back and forth using the back/forward buttons in Firefox to load MT. Each and every time I tested your earlier fix, I clicked the MT button in the admin bar of my website. I would then make a css change in code view, and choose MT’s Exit option. Then I would click the MT button again in the admin bar, and the cycle repeats.


Sebastian

OK, that’s very useful to know. I will dig a bit a deeper tomorrow when I’m less tired 🙂


Sebastian

Hey, I haven’t been able to replicate the behaviour you’ve described. Although that might simply be due to the intermittent nature of it. However, I’ve prevented browsers from ever caching the HTML state of the Microthemer interface, and it’s possible this might solve your issue too. This issue isn’t actually specific to FF by the way, I had just disabled caching via Chrome’s dev tools.

Could you try the following (unreleased) update please? If you get the flash warning again, I will go back to the drawing board.

I need to finish for the day now as I have childcare and then a wedding anniversary dinner later. But I can pick this up again tomorrow afternoon (UK time). I’d really like to get this firmly resolved.

Thanks so much for sticking with me so far.

Sebastian


rhkittredge

Still getting the error although looks like you added some diagnostic info. I now see the following in addition to the main error:

Last save time: 1600959564
Stored save time: 1600959579
Difference: -15


Sebastian

OK, thanks for sharing the debug info. When the problem was triggered by the browser caching issue, the difference I saw was always larger than -15, so I think the cause is separate. Can I just confirm:

a) This only ever happens to you at the point of existing MT (rather than when you save settings in MT)?
b) The alert only ever lasts half a second, and never stays permanently (until clicked)?

Thanks,
Sebastian


Sebastian

In case the new warning about settings not being saved is causing your issue, here is another version with that functionality removed.

I’m sorry about how inefficient this trial and error process is. It would be much easier if I could replicate the issue. But I’ve not been able to despite many many attempts.

Cheers,
Sebastian


rhkittredge

Answering your first question: I am not sure what you mean by “save settings”. When I make a change in MT I see it automatically says saving settings. Then I choose Exit->Site frontend. For the second question, yes the alert is half a second or less. Only way to even see what it says is to take a screenshot and then look at the screenshot. It flashes by and continues on its way. The issue with not saving the entire selector is fixed, but in so doing now I see the popup.

I’ll try your newer version and please don’t apologize; I’m so glad to be of help! It’s got to be annoying you can’t reproduce the problem. I will try testing in a private window without any browser addons enabled and see if that makes any difference too.


rhkittredge

Just tried the new download. Problem still happens although seems less often. I tried it in a private window with no browser addons. I did catch the one time it showed up the difference showed as -13. I don’t know if/how speed would play into this; my PC is new, fast, plenty of memory and I have fast internet.

I know this maybe isn’t a real fix…but honestly this popup is not really an issue for me. It flashes so fast I hardly see it, and the selectors are saving properly. Maybe it’s not worth trying to debug if I seem to be the only one with the problem? That’s NOT to say I don’t want to continue to help however I can – happy to do so! Just letting you know I consider the original issue solved and this popup isn’t a huge deal to me.


Sebastian

Thanks for your understanding. I prefer to tie up loose ends, if at all possible. With our sample size of 2, it’s possible I’m in the minority not getting the popup. To help determine that, could also try replicating the issue on the live demo:

https://livedemo.themeover.com/setting-up-demo-site/?create_demo

If you can’t, perhaps it is indeed specific to your WP setup. I would be happy to troubleshoot on your site, if you don’t mind sending access via our secure contact form. Or just leave it, if you are OK to live with it.

Cheers,
Sebastian


Sebastian

And by saving settings, I just meant making a change in the code editor which triggers MT to auto-save. Normally the multiple tabs warning shows at the point saving settings, when its working as its meant to.


rhkittredge

I just tried via your live demo and the issue does happen, albeit not as often. The popup flashes by about twice as fast as my site, I imagine because it’s a bare-bone site with few plugins/overhead compared to my site. I can’t see the error in the popup nor can I get a screenshot because my timing would have to be perfect.

Happy to give you credentials to my site(s) if you want. Just let me know. Thanks Sebastian!


Sebastian

Ah, that’s interesting. So it’s definitely not something specific to your site. I wonder if I’m just not doing the right actions. Could you take a look at the following video of me attempting to trigger the error and let me know if anything jumps out at you:

http://somup.com/cYQToJlcsM

Thanks!
Sebastian


rhkittredge

Thanks, the video looks similar to what I’m doing to cause this to happen. I tried making my own video to show you what I see but of course, it won’t happen (the car never makes the funny noise at the mechanic’s shop right). Problems don’t just fix themselves so I will keep trying and send you a video as soon as I get it.

I will say this: looked like you were testing with Chrome – I am testing with Firefox as it is my main browser for development.

You must login or register to reply to this topic.