()
| 53 | } |
| 54 | |
| 55 | function readFromQuery() { |
| 56 | if (!hasLocation()) return {}; |
| 57 | const params = new URLSearchParams(window.location.search); |
| 58 | const state = {}; |
| 59 | |
| 60 | PERSISTED_FIELDS.forEach((field) => { |
| 61 | if (!params.has(field)) return; |
| 62 | const value = params.get(field); |
| 63 | const parsed = pickValue(field, value); |
| 64 | if (parsed !== undefined) { |
| 65 | state[field] = parsed; |
| 66 | } |
| 67 | }); |
| 68 | |
| 69 | return state; |
| 70 | } |
| 71 | |
| 72 | function readFromStorage() { |
| 73 | if (!hasLocalStorage()) return {}; |
no test coverage detected