compiler-explorer / compiler-explorer

Run compilers interactively from your web browser and interact with the assembly
https://godbolt.org/
BSD 2-Clause "Simplified" License
15.96k stars 1.7k forks source link

[BUG]: History entry with IDE Tree does not get restored when clicked #4138

Open partouf opened 1 year ago

partouf commented 1 year ago

Describe the bug

I can see the state being restored while debugging in chrome, but something happens that it doesn't actually get applied or gets undone somehow.

Simarly if you restore a chrome session that had a IDE Tree, it will not be restored, instead a different situation will appear.

Steps to reproduce

-

Expected behavior

-

Reproduction link

Not applicable

Screenshots

Not applicable

Operating System

No response

Browser version

No response

partouf commented 1 year ago

Screenshot from 2022-10-10 23-23-43

partouf commented 1 year ago

console logged the exception that gets swallowed by local.set() ->

Uncaught DOMException: Failed to execute 'setItem' on 'Storage': Setting the value of 'gl' exceeded the quota.
    at Object.set (http://127.0.0.1:10240/static/main.js:13103:29)
    at HistoryWidget.onLoadCallback (http://127.0.0.1:10240/static/main.js:314:19)
    at HistoryWidget.onLoad (http://127.0.0.1:10240/static/main.js:26530:14)
    at HTMLAnchorElement.load (http://127.0.0.1:10240/static/main.js:26413:27)
    at HTMLAnchorElement.dispatch (http://127.0.0.1:10240/static/vendor.js:54699:27)
    at elemData.handle (http://127.0.0.1:10240/static/vendor.js:54503:28)
partouf commented 1 year ago

I did some measurements using https://stackoverflow.com/questions/2989284/what-is-the-max-size-of-localstorage-values and aparantly I can store strings of 5-ish mb in localstorage.

The json string in history is 16903 bytes...

partouf commented 1 year ago

When I load it manually by setting it in chrome console via window.localStorage.setItem('gl', "escapedjson"); or the storage interface thing, there is no error. But when I refresh the page, it just doesn't get restored.

partouf commented 1 year ago

window.hasUIBeenReset = true; helps somewhat...