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

chore: add safety for localstorage #2770

Merged
merged 5 commits into from
Aug 30, 2024
Merged

Conversation

zoruka
Copy link
Contributor

@zoruka zoruka commented Aug 29, 2024

Description

This PR is replacing usage of localStorage in the base package by adding an SafeLocalStorage object, which is typed and parsed data stored with JSON. This PR is also enabling test command in base package.

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

For Linear issues: Closes APKT-xxx
For GH issues: closes #...

Showcase (Optional)

If there is a UI change include the screenshots with before and after state.
If new feature is being introduced, include the link to demo recording.

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections

Copy link

vercel bot commented Aug 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
web3modal-gallery ✅ Ready (Inspect) Visit Preview Aug 30, 2024 0:52am
web3modal-laboratory ✅ Ready (Inspect) Visit Preview Aug 30, 2024 0:52am

Copy link
Contributor

github-actions bot commented Aug 29, 2024

Coverage Report for Coverage

Status Category Percentage Covered / Total
🔵 Lines 86.68% 3136 / 13137
🔵 Statements 86.68% 3136 / 13137
🔵 Functions 160.04000000000002% 233 / 720
🔵 Branches 213.57000000000002% 414 / 830
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
packages/base/adapters/evm/ethers/client.ts 0% 0% 0% 0% 1, 14-18, 41, 46, 49, 51, 56, 102, 104, 106, 108, 114, 125, 127, 133, 135, 137, 140-141, 143-145, 147-154, 156-168, 170-184, 186-189, 191-196, 198-201, 203-208, 210-212, 215-218, 220, 222-223, 226-230, 232-237, 239-250, 252-255, 257-262, 264, 266, 268-274, 276-277, 280-284, 288, 290-315, 317-328, 330-333, 335-339, 341-342, 344-369, 371-374, 376-385, 387-388, 390, 392, 394-395, 397-399, 401-403, 405-410, 412-414, 416-417, 419-420, 422-424, 426-428, 430-437, 439-442, 444-445, 447-448, 450-452, 454-456, 458-460, 462-464, 466-468, 470-471, 473-479, 481-483, 485-486, 488-489, 491-495, 497-500, 502, 504-506, 508-509, 511-514, 516-519, 521-524, 526, 528-530, 532-534, 541-545, 547-552, 554-555, 558-561, 563, 565-567, 569-571, 573-576, 579-580, 582-586, 589-596, 598-601, 603-604, 606-607, 609-611, 613-617, 619-620, 622-624, 626-628, 630-632, 634-636, 638-640, 642-643, 645-647, 649-665, 668-671, 673-674, 676-679, 681-683, 685-696, 698, 700-701, 703-710, 712-718, 720-722, 724-732, 734-735, 737-752, 754-756, 758-762, 764-766, 768-770, 772-778, 780-782, 784-795, 797-807, 809-820, 822-836, 838-840, 842-858, 860-861, 863-879, 881-900, 902-903, 905-913, 915-916, 918-925, 927-940, 942-943, 945-951, 953-958, 960-964, 966-971, 973-974, 976-978, 980-983, 985-993, 995-1003, 1005-1010, 1012-1019, 1021-1034, 1036-1044, 1046-1051, 1053-1058, 1060-1063, 1065-1073, 1075-1080, 1082-1087, 1089-1108, 1110-1117, 1119-1120, 1122-1129, 1131-1137, 1139-1142, 1144-1148, 1150-1164, 1166-1174, 1176-1181, 1183-1184, 1186-1189, 1191-1194, 1196-1200, 1202-1208, 1210-1216, 1218-1219, 1221-1249, 1251-1263, 1265-1266, 1268-1273, 1275-1276, 1278-1285, 1287-1300, 1302-1305, 1307-1314, 1316-1320, 1322-1324, 1326-1330, 1332-1351, 1353-1363, 1365-1369, 1371-1372, 1374-1380, 1382-1401, 1403-1417, 1419-1425, 1427-1448, 1450-1468, 1470-1472, 1474-1487, 1489-1490, 1492-1503, 1505-1519, 1521-1531, 1533-1534, 1536-1538, 1540-1550, 1552-1562, 1564-1575, 1577-1589, 1591-1594, 1596-1600, 1602-1609
packages/base/adapters/evm/ethers5/client.ts 0% 0% 0% 0% 1, 13-16, 25, 30, 32, 37, 83, 85, 89, 91, 97, 99, 103, 111, 113, 115, 117-118, 120-122, 124-131, 133-145, 147-161, 163-166, 168-173, 175-178, 180-185, 187-189, 191, 193-194, 197-201, 203-208, 210-221, 223-226, 228-233, 235, 237, 239-245, 247-248, 251-255, 259, 261-286, 288-297, 299-302, 304-308, 310-311, 313-336, 338-341, 343-354, 356-357, 359-360, 362, 364-366, 368-370, 372-374, 376-383, 385-386, 388-389, 391-394, 396-399, 401-404, 406, 408-410, 412-414, 421-425, 427-432, 434-435, 437-439, 441-443, 446-449, 451-452, 457-458, 460-464, 467-474, 476-479, 481-482, 484-485, 487-489, 491-493, 495-497, 499-501, 503-505, 507-509, 511-513, 515-518, 520-526, 529-532, 534-535, 537-543, 545-555, 557, 559-560, 562-570, 572-573, 575-589, 591-593, 595-599, 601-603, 605-607, 609-615, 617-619, 621-632, 634-644, 646-661, 663-664, 666-678, 680-682, 684-696, 698-713, 715-716, 718-720, 722-725, 727-732, 734-738, 740-745, 747-748, 750-752, 754-757, 759-767, 769-777, 779-784, 786-789, 791-794, 796-804, 806-814, 816-819, 821-823, 825-827, 829-832, 834-841, 843-848, 850-855, 857-860, 862, 864-865, 867, 869-870, 872-876, 878-883, 885-891, 893-894, 896-923, 925-937, 939-940, 942-947, 949-950, 952-959, 961-972, 974-977, 979-991, 993-995, 997-1001, 1003-1008, 1010-1023, 1025-1029, 1031-1032, 1034-1039, 1041, 1043-1055, 1057-1063, 1065-1086, 1088-1101, 1103-1104, 1106-1117, 1119-1133, 1135-1145, 1147-1148, 1150-1161, 1163-1175, 1177-1180, 1182-1186, 1188-1195, 1197-1203, 1205-1207, 1209-1216
packages/base/adapters/solana/web3js/client.ts 0% 0% 0% 0% 1, 9-11, 13, 16-17, 35-37, 43-44, 48, 65-66, 68, 70, 72, 76, 84, 88, 90-91, 93-95, 97, 99, 101, 103-112, 114-118, 120-124, 126-131, 133-137, 139-141, 143, 145-146, 148-151, 153-155, 157-158, 160-162, 164-168, 170, 172-173, 175, 182, 184, 186, 188, 190, 192-194, 196-197, 199, 201-203, 205, 207, 209, 211-213, 215-220, 222, 224-227, 229-230, 232-236, 238-240, 242-244, 246-248, 250-252, 254-255, 257-259, 261-267, 269-282, 284-286, 288-290, 292-294, 296-298, 300-302, 305-307, 309-324, 326-328, 330-334, 336-342, 344-347, 349-351, 353-355, 357-362, 364-379, 381-382, 384-386, 388-391, 393-395, 397-400, 402-405, 407-412, 414-420, 422-435, 437-439, 441-444, 447-449, 451-454, 456-461, 463, 465, 467-472, 474, 482-485, 487-503, 505-512, 515-518, 520-525, 528-531, 533-540, 542-544, 546-552, 554-562, 564-570, 572-575, 577-578, 580-588, 590-593, 595-611, 613-615, 617-618, 620-622, 624-627, 629-630, 632-641, 643-645
packages/base/utils/SafeLocalStorage.ts 93.54% 87.5% 100% 93.54% 24-25
Generated in workflow #5866

Copy link
Contributor

github-actions bot commented Aug 29, 2024

♻️ Vite-Size ♻️

Size Difference

Size (kb) Gzip (kb)
Total Diff. 0 0

Current Size

Name Size (kb) Gzip (kb)
assets/index-m39LepVg.js 1475.108 417.506
assets/noble-curves.js 31.941 12.779
assets/2.19.6_bufferutil.js 2.789 1.325
assets/index.js 161.83 59.282
assets/index2.js 102.249 29.112
assets/index3.js 304.389 87.279
assets/walletconnect-ethereum-provider.js 278.197 80.093
assets/index4.js 11.601 3.211
assets/w3m-modal.js 6.992 2.507
assets/index5.js 12.674 4.695
assets/hooks.module.js 74.776 25.684
assets/walletconnect-modal-ui.js 112.43 34.327
index.html 0.329 0.235
Total Size 2575.305 758.035

Base Size

Name Size (kb) Gzip (kb)
assets/index-m39LepVg.js 1475.108 417.506
assets/noble-curves.js 31.941 12.779
assets/2.19.6_bufferutil.js 2.789 1.325
assets/index.js 161.83 59.282
assets/index2.js 102.249 29.112
assets/index3.js 304.389 87.279
assets/walletconnect-ethereum-provider.js 278.197 80.093
assets/index4.js 11.601 3.211
assets/w3m-modal.js 6.992 2.507
assets/index5.js 12.674 4.695
assets/hooks.module.js 74.776 25.684
assets/walletconnect-modal-ui.js 112.43 34.327
index.html 0.329 0.235
Total Size 2575.305 758.035

@zoruka zoruka merged commit fe31c83 into main Aug 30, 2024
14 checks passed
@zoruka zoruka deleted the chore/add-safety-for-localstorage branch August 30, 2024 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants