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: Brand colors sometimes shows different colors on cloud #19672

Merged
merged 18 commits into from
Feb 2, 2023

Conversation

jsartisan
Copy link
Contributor

Caches the tenant config so that we don't show the ugly black color

Description

Fixes #19530

Type of change

  • Bug fix

How Has This Been Tested?

  • Manual

Test Plan

Add Testsmith test cases links that relate to this PR

Issues raised during DP testing

Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR)

Checklist:

Dev activity

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • PR is being merged under a feature flag

QA activity:

  • Test plan has been approved by relevant developers
  • Test plan has been peer reviewed by QA
  • Cypress test cases have been added and approved by either SDET or manual QA
  • Organized project review call with relevant stakeholders after Round 1/2 of QA
  • Added Test Plan Approved label after reveiwing all Cypress test

@vercel
Copy link

vercel bot commented Jan 10, 2023

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

Name Status Preview Comments Updated
appsmith ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 1, 2023 at 6:37AM (UTC)

@github-actions github-actions bot added Widgets Product This label groups issues related to widgets Branding Product All issues under branding and whitelabelling appsmith ecosystem Bug Something isn't working Needs Triaging Needs attention from maintainers to triage and removed Bug Something isn't working labels Jan 10, 2023
@github-actions github-actions bot added the Bug Something isn't working label Jan 11, 2023
Copy link
Contributor

@keyurparalkar keyurparalkar left a comment

Choose a reason for hiding this comment

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

Are we using multi-tenant Architecture to manage branding of each company? if yes how are we cache if multiple tenants are present in a single browser session? For example, Two tenants: ABC and XYZ have different branding configs, then how are we caching these configs in local storage.
I think in that scenario we should cache tenantConfig based on each tenant.

const cachedTenantConfig = localStorage.getItem("tenantConfig");
let cachedTenantConfigParsed = {
brandColors: {
...createBrandColorsFromPrimaryColor("#000"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets move this color to a constant

if (cachedTenantConfig) {
cachedTenantConfigParsed = JSON.parse(cachedTenantConfig);
}
} catch (e) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than a blank catch block, can we use log.debug to log any errors that occur

return {
...cachedTenantConfigParsed,
...(state.tenant?.tenantConfiguration || {}),
} as Record<string, any>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the as keyword, We can instead provide the return type in the function definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

export const initialState: TenantReduxState<any> = {
userPermissions: [],
tenantConfiguration: {
brandColors: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since earlier we were setting the initial state with some value, why are we replacing it with the blank object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes because the logic for setting default values is now moved to the selector instead of the reducer.

keyurparalkar
keyurparalkar previously approved these changes Jan 12, 2023
@jsartisan
Copy link
Contributor Author

/ok-to-test sha=0986124

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/4013203840.
Workflow: Appsmith External Integration Test Workflow.
Commit: 0986124.
PR: 19672.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=19672&runId=4013203840_1

@github-actions
Copy link

The following are new failures, please fix them before merging the PR

@github-actions
Copy link

The following are new failures, please fix them before merging the PR cypress/integration/Regression_TestSuite/ClientSideTests/Templates/Fork_Template_To_App_spec.js

@jsartisan
Copy link
Contributor Author

/ok-to-test=b8b2b80

@jsartisan
Copy link
Contributor Author

/ok-to-test sha=b8b2b80

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/4051368563.
Workflow: Appsmith External Integration Test Workflow.
Commit: b8b2b80.
PR: 19672.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=19672&runId=4051368563_1

@github-actions
Copy link

The following are new failures, please fix them before merging the PR

@github-actions
Copy link

The following are new failures, please fix them before merging the PR cypress/integration/Regression_TestSuite/Application/PromisesApp_spec.js
cypress/integration/Regression_TestSuite/ClientSideTests/Linting/BasicLint_spec.ts
cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js

@github-actions
Copy link

The following are new failures, please fix them before merging the PR

@github-actions
Copy link

The following are new failures, please fix them before merging the PR cypress/integration/Regression_TestSuite/ClientSideTests/Linting/BasicLint_spec.ts
cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js
cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js

@github-actions
Copy link

The following are new failures, please fix them before merging the PR

@github-actions
Copy link

The following are new failures, please fix them before merging the PR cypress/integration/Regression_TestSuite/ClientSideTests/Linting/BasicLint_spec.ts
cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js
cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js

@jsartisan
Copy link
Contributor Author

/ok-to-test sha=fb2d586

@github-actions
Copy link

github-actions bot commented Feb 1, 2023

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/4061641296.
Workflow: Appsmith External Integration Test Workflow.
Commit: fb2d586.
PR: 19672.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=19672&runId=4061641296_1

@github-actions
Copy link

github-actions bot commented Feb 1, 2023

The following are new failures, please fix them before merging the PR

@github-actions
Copy link

github-actions bot commented Feb 1, 2023

The following are new failures, please fix them before merging the PR cypress/integration/Regression_TestSuite/ClientSideTests/Git/GitSync/GitBugs_spec.js

@dilippitchika dilippitchika self-requested a review February 2, 2023 06:09
@jsartisan jsartisan merged commit b314bd7 into release Feb 2, 2023
@jsartisan jsartisan deleted the chore/cache-branding-values branch February 2, 2023 06:13
@jsartisan jsartisan restored the chore/cache-branding-values branch February 7, 2023 07:05
@Nikhil-Nandagopal Nikhil-Nandagopal added Platform Administration Pod Issues related to platform administration & management and removed Widgets Product This label groups issues related to widgets labels Aug 6, 2024
Copy link
Contributor

coderabbitai bot commented Aug 6, 2024

Warning

Rate limit exceeded

@Nikhil-Nandagopal has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 28 minutes and 46 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 7ca4f73 and fb2d586.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Branding Product All issues under branding and whitelabelling appsmith ecosystem Bug Something isn't working Needs Triaging Needs attention from maintainers to triage Platform Administration Pod Issues related to platform administration & management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Brand colors sometimes shows different colors on cloud
5 participants