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

Auto saved query no longer loading #15997

Closed
darrentayloruk opened this issue Feb 26, 2020 · 16 comments · Fixed by #16438 · May be fixed by #16456
Closed

Auto saved query no longer loading #15997

darrentayloruk opened this issue Feb 26, 2020 · 16 comments · Fixed by #16438 · May be fixed by #16456
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
Milestone

Comments

@darrentayloruk
Copy link

darrentayloruk commented Feb 26, 2020

Describe the bug

The get auto-saved query button always shows the message

"No previously auto-saved query is available. Loading default query."

Rather than loading a previous query

To Reproduce

Steps to reproduce the behavior:

  1. Login to PMA
  2. Go to the SQL tab for a particular table
  3. Write and run an SQL statement
  4. Return to the SQL tab and press "Get auto-saved query"
  5. Message prompt "No previously auto-saved query is available. Loading default query."

Expected behavior

On pressing Get auto-saved query it should load the previous query that was created and ran

Screenshots

Initial Error
image

I can see the SQL being written into localStorage as I type
image
image

But on submitting a query I can see this value is removed in /js/vendor/sql.js
image

Server configuration

  • Operating system: Linux
  • Web server: Apache/2.4.38 (Debian)
  • PHP version: 7.4.1
  • phpMyAdmin version: 5.0.1

Client configuration

  • Browser: Firefox 73.0.1 (64-bit)
  • Operating system: Windows 10
@williamdes williamdes added the Bug A problem or regression with an existing feature label Feb 26, 2020
@williamdes williamdes added this to the 5.0.2 milestone Feb 26, 2020
@williamdes williamdes added this to Needs triage in issues via automation Feb 26, 2020
@williamdes
Copy link
Member

Confirmed, I tested on 4.9 and it worked fine.
Investigating..

@williamdes
Copy link
Member

Introduced by 9c7c5ca in #14166

@Piyush3079 do you know if you did introduce a regression by trying to fix #14093 ?

@williamdes
Copy link
Member

@MauricioFauth could I have your advice on this one ?

@ibennetch ibennetch modified the milestones: 5.0.2, 5.0.3 Mar 21, 2020
@Bllacky
Copy link

Bllacky commented Mar 25, 2020

Just tried this on version 5.0.2 and still not working. Not sure when it got broken, but it was working a few months ago.

@williamdes
Copy link
Member

It was broken since 5.0.0 alpha 1
I need some feedback to know if I can revert the change I mentioned or if it was expected in some way

@darrentayloruk
Copy link
Author

I've had a read over the commits and it's this change here:
"deleting auto_saved_sql on clicking submit query button "
6a44368#diff-330ef13a94973fd5d1aefa611e91b23eR451

image

Which was clearly intended, but I'm not yet clear on why it was needed as seems to be the breaker of this function.

I've commented out that code in a local version and can restore the previous query when switching been tabs/functions within the same table. Which is very handy, saves me most time and covers most my use case. I'll continue testing it.

I think there is somewhere else clearing it if I switch to another table, will look for it.

Let me know if I can help in any other way

@williamdes
Copy link
Member

Let me know if I can help in any other way

If you find the other piece of code that clears the storage I would be interested to know where to find it

@ibennetch could you give your point of view on this issue ?

@darrentayloruk
Copy link
Author

Yep it appears to be here

if (isStorageSupported('localStorage')) {

On navigate away asks for confirmation and clears it

@williamdes williamdes moved this from Needs triage to to be fixed soon in issues May 3, 2020
@williamdes williamdes removed this from the 5.0.3 milestone Jun 7, 2020
@shucon
Copy link
Contributor

shucon commented Oct 27, 2020

@williamdes from what I remember, it might be a regression. There were a lot of bugs fixed in #14166 , the intention for removing the saved query was that page change should not show query from another page as mentioned here: https://github.com/phpmyadmin/phpmyadmin/pull/14094/files

@shucon
Copy link
Contributor

shucon commented Oct 27, 2020

Should I go ahead and fix this?

@Bllacky
Copy link

Bllacky commented Oct 27, 2020

Please fix this! I used the Auto-save function extensively as it improves productivity.

shucon added a commit to shucon/phpmyadmin that referenced this issue Oct 27, 2020
Signed-off-by: Saksham Gupta <shucon01@gmail.com>
shucon added a commit to shucon/phpmyadmin that referenced this issue Jan 21, 2021
Signed-off-by: Saksham Gupta <shucon01@gmail.com>
shucon added a commit to shucon/phpmyadmin that referenced this issue Jan 21, 2021
Signed-off-by: Saksham Gupta <shucon01@gmail.com>
@williamdes williamdes added this to the 5.1.0 milestone Jan 31, 2021
@williamdes williamdes self-assigned this Feb 9, 2021
@williamdes williamdes added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Feb 9, 2021
williamdes added a commit that referenced this issue Feb 9, 2021
…ndent (fix SQL query auto save)

Pull-request: #16438
Fixes: #15997

Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Feb 9, 2021
Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from to be fixed soon to Closed Feb 9, 2021
@williamdes
Copy link
Member

This will be fixed in 5.1.0 ! 🚀

@MatthiasNZ
Copy link

Just installed 5.1.0

Queries are still not auto-saved!

@williamdes
Copy link
Member

Just installed 5.1.0

Queries are still not auto-saved!

I often use the query saving feature, it works
Could you describe how you are using the feature please?

@MatthiasNZ
Copy link

MatthiasNZ commented May 15, 2021

@williamdes :

  1. I type a simple query, like SELECT * FROM MyTable WHERE <some condition> into the SQL tab: result appears fine.
  2. Then click on some other table in the table navigation panel (LH side), which defaults to BROWSE (i.e. SELECT * FROM MyNewTable).
  3. I then click on the SQL tab again. "Get auto-saved query" : produces the message "No previously auto-saved query is available..."

This used to work fine in earlier versions (not sure exactly which)

@williamdes
Copy link
Member

This used to work fine in earlier versions (not sure exactly which)

Could you find what version this was ?

result appears fine.

If you do not run the query and for example click on another database the save feature will work

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
issues
  
Closed
6 participants