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

fix: input toggles dont use localStorage #450

Conversation

SgtPooki
Copy link
Member

@SgtPooki SgtPooki commented Nov 13, 2024

Title

fix: input toggles dont use localStorage

Description

Removes the last of the localStorage use for inputs on the config page. Merging this and #448 should unblock #399 & #446.

This change also removes the HeliaCommsChannel broadcast channel, and instead does a request to /#/ipfs-sw-config-reload to tell the SW to update verified fetch. This has resulted in much more consistent updates of the service worker when new config is saved.

Fixes #449

Notes & open questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

@SgtPooki SgtPooki mentioned this pull request Nov 13, 2024
3 tasks
@SgtPooki SgtPooki requested a review from 2color November 13, 2024 22:58
@SgtPooki SgtPooki self-assigned this Nov 13, 2024
@SgtPooki SgtPooki force-pushed the 449-create-toggle-component-and-replace-local-storage-toggle-with-it branch from b95d53c to 5e4edf1 Compare November 13, 2024 23:08
Base automatically changed from 447-create-input-component-and-replace-local-storage-input-with-it to main November 14, 2024 13:54
Copy link
Member Author

@SgtPooki SgtPooki left a comment

Choose a reason for hiding this comment

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

self review

src/context/config-context.tsx Outdated Show resolved Hide resolved
Comment on lines +79 to +83
const resp = await fetch('/#/ipfs-sw-config-reload')

if (!resp.ok) {
throw new Error('Failed to reload config')
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Need to call the endpoint manually instead of using tellSwToReloadConfig because this is executed inside the page

@SgtPooki SgtPooki linked an issue Nov 14, 2024 that may be closed by this pull request
@SgtPooki SgtPooki merged commit c838307 into main Nov 14, 2024
16 checks passed
@SgtPooki SgtPooki deleted the 449-create-toggle-component-and-replace-local-storage-toggle-with-it branch November 14, 2024 14:14
SgtPooki added a commit that referenced this pull request Nov 14, 2024
* fix: dont use local storage for text config items

* fix: input toggles dont use localStorage

* fix: input-toggle uses resetKey

* fix: do not use broadcast channels to tell sw to update config

* chore: fix build

* chore: dont set debug var by default
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.

Create toggle component and replace local-storage-toggle with it
1 participant