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(client/public): avoid global variable #9598

Closed
wants to merge 0 commits into from
Closed

fix(client/public): avoid global variable #9598

wants to merge 0 commits into from

Conversation

mtrucc
Copy link
Contributor

@mtrucc mtrucc commented Sep 4, 2023

Summary

Fixes #9597

Problem

Unreasonable global variables 'c'

Solution

const c = { light: "#ffffff", dark: "#1b1b1b" };

Replace the global variable named 'c' to 'themeConfig'


Screenshots

Before

After


How did you test this change?

Open developer tools

Enter the following command in the console

let a = 1
let b = 2
let c = 3

No error reported

Copy link
Member

@LeoMcA LeoMcA left a comment

Choose a reason for hiding this comment

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

I'd leave the variable as-is, but instead wrap the whole contents of the script tag in an IIFE

You also need to update the CSP hash as explained in the comment at the top of the script

@mtrucc
Copy link
Contributor Author

mtrucc commented Sep 4, 2023

I'd leave the variable as-is, but instead wrap the whole contents of the script tag in an IIFE

You also need to update the CSP hash as explained in the comment at the top of the script

Thanks for the tip
I modified the following:

  1. Restored variable naming
  2. Wrap the whole contents of the script tag in an IIFE
  3. Update the CSP hash

@caugner caugner changed the title Replace the global variable named fix(client/public): avoid global variable Sep 6, 2023
Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

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

Thank you, LGTM! 🙌

@caugner
Copy link
Contributor

caugner commented Sep 6, 2023

@mtrucc Please have a look at the failing "Commit signatures" check:

❌ PR contains 2 unverified commit(s)!

Please note that we require that all commits are signed.
Please see the documentation about signed commits and how to sign yours on GitHub:

Once you have set up commit signatures, you can sign your existing commits:

git rebase main --exec "git commit --amend --gpg-sign --no-edit"

Then you will need to force-push your branch once:

git push --force

@mtrucc
Copy link
Contributor Author

mtrucc commented Sep 6, 2023

@mtrucc Please have a look at the failing "Commit signatures" check:

❌ PR contains 2 unverified commit(s)!
Please note that we require that all commits are signed.
Please see the documentation about signed commits and how to sign yours on GitHub:

Once you have set up commit signatures, you can sign your existing commits:
git rebase main --exec "git commit --amend --gpg-sign --no-edit"
Then you will need to force-push your branch once:
git push --force

I'm so sorry I didn't notice this
I usually use GitHub Desktop to submit code
but i didn't set
git config --global commit.gpgsign true
Thank you for your reminder

@caugner
Copy link
Contributor

caugner commented Sep 6, 2023

@mtrucc It looks like you just ran git merge main or similar after enabling commit.gpgsign.

Can you please run git rebase main --exec "git commit --amend --gpg-sign --no-edit" once, which should re-sign your first two commits, and then git push --force? 🙏

@mtrucc
Copy link
Contributor Author

mtrucc commented Sep 6, 2023

@mtrucc It looks like you just ran git merge main or similar after enabling commit.gpgsign.

Can you please run git rebase main --exec "git commit --amend --gpg-sign --no-edit" once, which should re-sign your first two commits, and then git push --force? 🙏

The command has been executed. Please try it again. Thanks.

@github-actions github-actions bot added dependencies Pull requests that update a dependency file deployer Deployment (currently using AWS S3 and AWS Lambda) merge conflicts 🚧 Please rebase onto or merge the latest main. labels Sep 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

This pull request has merge conflicts that must be resolved before it can be merged.

@mtrucc
Copy link
Contributor Author

mtrucc commented Sep 6, 2023

The PR contained in contains 2 unverified commits
Do a fork and commit again
#9619

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file deployer Deployment (currently using AWS S3 and AWS Lambda) merge conflicts 🚧 Please rebase onto or merge the latest main.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unreasonable global variables
3 participants