Coder Social home page Coder Social logo

Comments (33)

VibeDesign avatar VibeDesign commented on August 15, 2024 1

Still no change unfortunately. Here's my testing routine again, just in case I should change anything:

  1. Clear Cache in Manager and Logout
  2. Clear Browser Cache and delete core/cache folder
  3. Login and select Articles Container resource
  4. Select and open any Article by using the "Edit" Button
  5. Immediately click the "Close" button to check for alert
  6. Click "Save" and then "Close" button to check for alert
  7. Make a change in the Articles content, click "Save" and then "Close" button to check for alert

from articles.

watou avatar watou commented on August 15, 2024 1

Yes, sorry, I do get the warning, after 1.7.12 installed in place of 1.7.11, adding the || typeof this.getFieldValue() === 'undefined' condition per ab1f866, rm -rf core/cache, logout all users, clear browser cache, open JavaScript Console, go to edit a NewsArticle, choose close, same old incorrect warning box as always.

from articles.

watou avatar watou commented on August 15, 2024 1

Question: why does the Articles addon check fp.warnUnsavedChanges (see here) whereas this piece of MODX manager code checks fp.isDirty()?

from articles.

watou avatar watou commented on August 15, 2024 1

Success! For me, 1.7.12 + ab1f866 + 0761f79 have corrected the unwanted warning messages for nonexistent unsaved changes on Chrome Version 75.0.3770.100 (Official Build) (64-bit) on Mac.

My changes to check fp.isDirty() instead of fp.warnUnsavedChanges do not seem to be needed also, so I've backed them out of my setup. But this discrepancy between MODX manager code fragment and the Articles addon is still disconcerting.

from articles.

jaygilmore avatar jaygilmore commented on August 15, 2024

I don't believe this is the same issue but most likely related to #68 and state of dirty/changed fields.

from articles.

gadgetto avatar gadgetto commented on August 15, 2024

Still present in latest 1.7.8 under MODX Revo 2.2.14

from articles.

VibeDesign avatar VibeDesign commented on August 15, 2024

Five years later... still showing this message, although latest changelog claims that it's fixed (it's NOT):

Articles 1.7.12

  • Warn users about unsaved changes only if there are actual unsaved changes

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

@VibeDesign, does it help if you clear the cache of your browser?
If not, please let me know what browser you are running.

from articles.

VibeDesign avatar VibeDesign commented on August 15, 2024

@JoshuaLuckers I deleted the browser cache, MODX cache via the manager and manual wiped core/cache, unfortunately still the same issue on latest Firefox Quantum 67.0.4 (64-Bit) and also Chrome Version 75.0.3770.100 (Offizieller Build) (64-Bit)

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

Thanks for reporting back. What version of MODX are you running? Does it happen for other resources or only when editing Articles?

I want to get to the bottom of this issue and make sure to fix it for everyone!

from articles.

VibeDesign avatar VibeDesign commented on August 15, 2024

@JoshuaLuckers Thanks for your work! Really appreciate someone to work on this extra!

I'm running MODX 2.7.1-pl and I only face this issue with Articles resources (the resources within the Articles container resource to be exact).

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

I'm able to reproduce this in Chrome, it works fine in Safari.

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

@VibeDesign would you like to test if this change (0761f79) works for you?

from articles.

VibeDesign avatar VibeDesign commented on August 15, 2024

@JoshuaLuckers This doesn't work unfortunately. I made the change, cleared browser and MODX cache, but still the prompt shows up, after articles resource was already saved.

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

Did you notice any improvement? What did you do (step by step) to trigger the alert?

from articles.

VibeDesign avatar VibeDesign commented on August 15, 2024

Seemed all the same like before.

  1. Opened the Articles container resource via the resource tree
  2. Selected an(y) article by clicking on the "edit" button
  3. Made a change in the articles content
  4. Hit Save Button
  5. Hit Close Button or select any other resource
  6. Alert pops up.

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

I didn’t test that use case, thanks. My change fixes the unnecessary warning when the article is not edited and saved (same steps as provided by you except 3 & 4).

from articles.

VibeDesign avatar VibeDesign commented on August 15, 2024

Hitting save without changing the content still triggered the alert for me.

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

I'll continue working on this upcoming weekend.

from articles.

BobRay avatar BobRay commented on August 15, 2024

from articles.

VibeDesign avatar VibeDesign commented on August 15, 2024

I don't have Notify installed.

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

When saving an Article it’s being marked as dirty. I haven’t figured out yet why this happens.

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

@VibeDesign would you like to test another change? (ab1f866)

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

What happens if you add console.log(this.getFieldValue()) before line 71 in assets/components/articles/js/extras/tagfield.js? I’m curious what it logs in step 7.

from articles.

watou avatar watou commented on August 15, 2024

What happens if you add console.log(this.getFieldValue()) before line 71 in assets/components/articles/js/extras/tagfield.js? I’m curious what it logs in step 7.

I am running 1.7.12, client is Chrome, I add this line and it prints undefined in the console. I added this line to 1.7.11 and it also prints undefined in the console. So either the field value is the string undefined, or the dirty flagging isn't in this area? Chrome Version 75.0.3770.100 (Official Build) (64-bit) on Mac.

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

@watou thanks, do you get the warning as well after applying this change? ab1f866

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

Does it help if you change it to fp.isDirty() (together with the other changes)?

from articles.

watou avatar watou commented on August 15, 2024

The only difference it appears to make is that one warning box is presented instead of another one. When fp.warnUnsavedChanges is tested, you get the box that contains "Warning!
You have changes pending; are you sure you want to cancel? Yes No". When the code instead tests for fp.isDirty(), you instead get the Chrome-provided box that has the Chrome logo, asks "Leave Site? The changes that you made may not be saved. Cancel Leave"

If I actually change the text of the article, I will get the warning box that indicates that isDirty() is returning true.

So could this mean that fp.isDirty() is false when it should be, but something Chrome-specific is triggering a browser-level dirty flag out of view of Ext.js (if that makes sense)?

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

Just a quick note: make sure to also apply this change: 0761f79

from articles.

VibeDesign avatar VibeDesign commented on August 15, 2024

Indeed that works! I probably reverted the first change, so it wasn't working. Now I don't get any false alerts!

I notice though, that I get a Firefox prompt now, wheter I want to save a login with the username "No" and a what seems randomly generated password. Not sure if this is related, but I haven't seen this before and also didn't change anything else on the site recently.
prompt

from articles.

watou avatar watou commented on August 15, 2024

@VibeDesign For me, 1.7.12 + ab1f866 + 0761f79 do not cause a strange save login save message on Firefox 68.0 for Mac.

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

Thanks @watou and @VibeDesign for the great help!

My changes to check fp.isDirty() instead of fp.warnUnsavedChanges do not seem to be needed also, so I've backed them out of my setup. But this discrepancy between MODX manager code fragment and the Articles addon is still disconcerting.

I'll switch it back to fp.isDirty(). I noticed warnUnsavedChanges being set to true/false at various places and came across this line of code (changing it did solve the issue for me in the first place) :

window.onbeforeunload = function() {
    if (panel.warnUnsavedChanges) return _('unsaved_changes');
};

Source

from articles.

JoshuaLuckers avatar JoshuaLuckers commented on August 15, 2024

Thanks again for all the help. I'm officially marking this issue as fixed!

from articles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.