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

docs: fixed regex for parsing base64String, and updated subscribeToPush function. #73940

Merged
merged 3 commits into from
Dec 17, 2024

Conversation

abyii
Copy link
Contributor

@abyii abyii commented Dec 14, 2024

What?

Change 1:
At line 107, the regex code is now fixed to replace all "-" with "+", which wasn't as expected with previous code, window.atob() would throw an error saying the string is not encoded properly. The variable base64 will now have a URL safe base64String.

Change 2:
At line 177 and 178, the function is now updated to call the server action subscribeUser() with a serialized object instead of a PushSubscription object, as server actions can only be called with serialized objects.

Why?

I followed to docs to setup a PWA project with next, and I encountered issues with the code mentioned in the documentation.

How?

The fixed code snippets will work as expected, and anyone following the docs later can find them helpful.

… function

Change 1:
At line 107, the regex code is now fixed to replace all "-" with "+", which wasn't as expected with previous code, window.atob() would throw an error saying the string is not encoded properly. The variable base64 will now have a URL safe base64String.

Change 2:
At line 177 and 178, the function is now updated to call the server action subscribeUser() with a serialized object instead of a PushSubscription object, as server actions can only be called with serialized objects.

Thankyou.
@ijjk ijjk added the Documentation Related to Next.js' official documentation. label Dec 14, 2024
@ijjk
Copy link
Member

ijjk commented Dec 14, 2024

Allow CI Workflow Run

  • approve CI run for commit: 4ef5c26

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@ijjk ijjk enabled auto-merge (squash) December 17, 2024 06:45
@ijjk ijjk merged commit 12a03ab into vercel:canary Dec 17, 2024
39 checks passed
@abyii abyii deleted the patch-3 branch December 22, 2024 15:53
@github-actions github-actions bot added the locked label Jan 6, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Related to Next.js' official documentation. locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants