Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State should not be dirty #319

Open
bilogic opened this issue Sep 11, 2022 · 8 comments
Open

State should not be dirty #319

bilogic opened this issue Sep 11, 2022 · 8 comments

Comments

@bilogic
Copy link

bilogic commented Sep 11, 2022

If we were to

  1. Load https://ondras.zarovi.cz/sql/demo/?keyword=default
  2. Click on an empty space once
  3. Try to close or jump to another URL
  4. Browser prompts us to save
  5. It should not, since no changes were made
@ondras
Copy link
Owner

ondras commented Sep 15, 2022

Good suggestion. We will need a way to track (unsaved) changes, though.

@bilogic
Copy link
Author

bilogic commented Sep 18, 2022

I have gotten this working, but need to understand which of my PRs you can accept so that I can find a suitable spot to PR this in. Thank you.

@bilogic
Copy link
Author

bilogic commented Sep 18, 2022

temporary parking spot for my code

// globals.js
window.onbeforeunload = function (e) {
    if (SQL.Designer.is_dirty) {
        return "" /* some browsers will show this text, some won't. */;
    } else {
        return undefined;
    }
};


// wwwsqldesigner.js
SQL.Designer = function () {
    SQL.Designer = this;

    this.is_dirty = false;

SQL.Designer.prototype.dirty = function (value, remarks) {
    if (value === undefined) {
        value = true;
    }
    this.is_dirty = value;
    console.log("Dirty flag set to", this.is_dirty, remarks);
};


// rowmanager.js - nothing
// row.js::update, up, down, changeComment, addRelation, removeRelation, addKey, removeKey, destroy
SQL.Designer.dirty();

// io.js 
SQL.Designer.dirty(false, "serversave");
SQL.Designer.dirty(false, "loadresponse");

@ondras
Copy link
Owner

ondras commented Oct 3, 2022

I have gotten this working, but need to understand which of my PRs you can accept so that I can find a suitable spot to PR this in. Thank you.

Sorry for being late all the time. As far as I can tell, there is only one PR pending right now (keyboard shortcuts); please feel free to submit this one based on the current master.

@bilogic
Copy link
Author

bilogic commented Oct 3, 2022

ok thanks!

@bilogic
Copy link
Author

bilogic commented Oct 3, 2022

@ondras this is the other one #321

@bilogic
Copy link
Author

bilogic commented Oct 17, 2022

bump :)

@bilogic
Copy link
Author

bilogic commented Oct 24, 2022

@ondras help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants