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

[Console] Handle the case where saving to history may throw an error #62424

Conversation

jloleysens
Copy link
Contributor

@jloleysens jloleysens commented Apr 3, 2020

Summary

We should still show the request result even if localStorage is full (or any other save error occurs).

Fix #62203

How to test

Run the following script in browser console:

const prefix = 'THIS_IS_GARBAGE_DATA_'

function fillLocalStorage() {
  const data = 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'
  let idx = 0
  while(true) {
    localStorage[prefix + ++idx] = data
  }
}

function undoFillLocalStorage() {
  Object.keys(localStorage).forEach(k => {
    if (k.startsWith(prefix)) {
      localStorage.removeItem(k)
    }
  })
}

Then run fillLocalStorage() and wait for the localStorage quota error to appear.

Run a request in Console and see the error notification appear, the request result should still appear in the output pane.

Run undoFillLocalStorage(). Then run a Console request again, this time there should be no error about localStorage quota.

Gif of request with history error

request-with-history-error

Release Note

We fixed an issue where Console would not render the request output if localStorage quota was reached.

We should still show the request result even if localStorage is
full (or any other save error occurs)
@jloleysens jloleysens added Feature:Console Dev Tools Console Feature Feature:Dev Tools release_note:fix v8.0.0 Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.7.0 v7.8.0 labels Apr 3, 2020
@jloleysens jloleysens requested a review from a team as a code owner April 3, 2020 11:22
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested locally. Thanks for fixing this @jloleysens!

…request_to_es/use_send_current_request_to_es.ts

Co-Authored-By: Alison Goryachev <alisonmllr20@gmail.com>
@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@jloleysens jloleysens merged commit ae9a751 into elastic:master Apr 6, 2020
@jloleysens jloleysens deleted the console/fix/handle-potential-add-history-error branch April 6, 2020 08:08
jloleysens added a commit to jloleysens/kibana that referenced this pull request Apr 6, 2020
…lastic#62424)

* Handle the case where saving to history may throw an error

We should still show the request result even if localStorage is
full (or any other save error occurs)

* Update src/plugins/console/public/application/hooks/use_send_current_request_to_es/use_send_current_request_to_es.ts

Co-Authored-By: Alison Goryachev <alisonmllr20@gmail.com>

Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
jloleysens added a commit to jloleysens/kibana that referenced this pull request Apr 6, 2020
…lastic#62424)

* Handle the case where saving to history may throw an error

We should still show the request result even if localStorage is
full (or any other save error occurs)

* Update src/plugins/console/public/application/hooks/use_send_current_request_to_es/use_send_current_request_to_es.ts

Co-Authored-By: Alison Goryachev <alisonmllr20@gmail.com>

Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
jloleysens added a commit that referenced this pull request Apr 6, 2020
…62424) (#62565)

* Handle the case where saving to history may throw an error

We should still show the request result even if localStorage is
full (or any other save error occurs)

* Update src/plugins/console/public/application/hooks/use_send_current_request_to_es/use_send_current_request_to_es.ts

Co-Authored-By: Alison Goryachev <alisonmllr20@gmail.com>

Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
jloleysens added a commit that referenced this pull request Apr 6, 2020
…62424) (#62564)

* Handle the case where saving to history may throw an error

We should still show the request result even if localStorage is
full (or any other save error occurs)

* Update src/plugins/console/public/application/hooks/use_send_current_request_to_es/use_send_current_request_to_es.ts

Co-Authored-By: Alison Goryachev <alisonmllr20@gmail.com>

Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Console Dev Tools Console Feature Feature:Dev Tools release_note:fix Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.7.0 v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Console throws error when the local storage exceeds the quota
4 participants