Skip to content

fix(client): set fcc-sound value in local storage after user data is fetched - #48106

Closed
nayabatir1 wants to merge 7 commits into
freeCodeCamp:mainfrom
nayabatir1:issue-46372
Closed

nayabatir1 wants to merge 7 commits into
freeCodeCamp:mainfrom
nayabatir1:issue-46372

Conversation

@nayabatir1

@nayabatir1 nayabatir1 commented Oct 17, 2022 •

Copy link
Copy Markdown
Contributor

Checklist:

  • I have read freeCodeCamp's contribution guidelines.
  • My pull request has a descriptive title (not a vague title like Update index.md)
  • My pull request targets the main branch of freeCodeCamp.
  • I have tested these changes either locally on my machine, or GitPod.

Closes #46372
Closes #48107

This is first method of solving issue
After user has logged in successfully I'm setting fcc-sound value in local storage after user data is fetched in fetchSessionUser.
As playTone grabs fcc-sound value from local storage to play audio

@nayabatir1
nayabatir1 requested review from a team, ShaunSHamilton and raisedadead October 17, 2022 19:38
@gitpod-io

gitpod-io Bot commented Oct 17, 2022

Copy link
Copy Markdown

@github-actions github-actions Bot added the platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. label Oct 17, 2022
@ghost

ghost commented Oct 17, 2022 •

Copy link
Copy Markdown

👀 Review this PR in a CodeSee Review Map

View the CodeSee Map of this change

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

@majestic-owl448

Copy link
Copy Markdown
Contributor

@nayabatir1 nayabatir1 changed the title fix(bug): campfire audio play on multiple browser fix(bug): set fcc-sound value in local storage after user data is fetched Oct 18, 2022
@nayabatir1

Copy link
Copy Markdown
Contributor Author

Please take a moment to give a name to the PR that follows the guidelines: https://contribute.freecodecamp.org/#/how-to-open-a-pull-request?id=prepare-a-good-pr-title

I've updated pr title.

@majestic-owl448 majestic-owl448 changed the title fix(bug): set fcc-sound value in local storage after user data is fetched fix(client): set fcc-sound value in local storage after user data is fetched Oct 18, 2022

@ojeytonwilliams ojeytonwilliams left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi, could you limit the scope of this PR? If we can remove Tone, that's great, and we really appreciate you looking into this. However, each PR should ideally do one thing so that we (as maintainers) can easily evaluate each change.

Could you create a separate PR with just the removal of Tone?

@raisedadead

Copy link
Copy Markdown
Member

This PR need NOT be reviewed any further until we have achieved agreement on #48107

@raisedadead raisedadead added the status: blocked In a transient & temporary hold. label Oct 18, 2022
@raisedadead
raisedadead marked this pull request as draft October 18, 2022 21:00
@socket-security

Copy link
Copy Markdown

Socket Security Pull Request Report

Dependency issues detected. If you merge this pull request, you will not be alerted to the instances of these issues again.

📞 Telemetry

This package contains telemetry which tracks you.

Package Note Location
[email protected] (added) Can be disabled by setting the environment variable NEXT_TELEMETRY_DISABLED=1 web/package.json
Pull request report summary
Issue Status
Install scripts ✅ 0 issues
Native code ✅ 0 issues
Bin script confusion ✅ 0 issues
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
Non-existent author ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ⚠️ 1 issue
Protestware/Troll package ✅ 0 issues
Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore [email protected] [email protected]

Powered by socket.dev

@raisedadead raisedadead added status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. and removed status: blocked In a transient & temporary hold. labels Nov 3, 2022
@raisedadead
raisedadead marked this pull request as ready for review November 3, 2022 19:55
Comment thread client/package.json
"sha-1": "1.0.0",
"store": "2.0.12",
"stream-browserify": "3.0.0",
"tone": "14.7.77",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs to be reverted.

Comment thread client/src/redux/fetch-user-saga.js Outdated

const sound = user[userId].sound;

localStorage.setItem('fcc-sound', sound);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we be using store here instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't understand what additional benefits store provide over localStorage api, also syntactically both are similar.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe store will adapt to use other storage APIs if the user is using a non-modern browser.

Comment on lines -67 to -71
if (tone.context.state !== 'running') {
tone.context.resume().catch(err => {
console.error('Error resuming audio context', err);
});
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this removed? We need to check that the audiocontext state is running, and if not, resume it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

reference doc
I'm using player.start() to play audio which is basically same thing. Start audio context from suspended state

@raisedadead raisedadead added status: waiting update Is awaiting update, after feedback or request for changes and removed status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. labels Nov 8, 2022
@Sembauke

Copy link
Copy Markdown
Member

Hey @nayabatir1,

Are you still working on this? Do you need help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. status: waiting update Is awaiting update, after feedback or request for changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Campfire Mode doesn't trigger on multiple browsers unless you turn it on and off

6 participants