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

RHCLOUD-32008: create internal jotai state for preview #2832

Merged
merged 1 commit into from
May 10, 2024

Conversation

florkbr
Copy link
Contributor

@florkbr florkbr commented May 10, 2024

Adds an internal state variable via jotai to track if preview is enabled or disabled.

Tested locally by adding a sub in the store with a console log (see screenshots). The state is correctly toggled with the preview toggle and initialized when chrome loads.

Preview disabled

Screenshot 2024-05-10 at 12 50 32 AM

Preview enabled

Screenshot 2024-05-10 at 12 50 44 AM

Adds an internal state variable via jotai to track if preview is enabled or disabled.

Tested locally by adding a sub in the store with a console log (see screenshots). The state is correctly toggled with the preview toggle and initialized when chrome loads.
@@ -0,0 +1,11 @@
import { WritableAtom, atom } from 'jotai';

// recipe from https://jotai.org/docs/recipes/atom-with-toggle
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Hyperkid123 thoughts on including this? This allows us to eventually toggle the atom value without the need for checking isBeta() in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

Eventually yes, but now with the URL and local storage being in play its a bit too early for it.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 92.30769% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 63.63%. Comparing base (0b0eaae) to head (59d1c25).

❗ Current head 59d1c25 differs from pull request most recent head 8e25d2e. Consider uploading reports for the commit 8e25d2e to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2832      +/-   ##
==========================================
+ Coverage   63.54%   63.63%   +0.08%     
==========================================
  Files         199      201       +2     
  Lines        4301     4314      +13     
  Branches      777      778       +1     
==========================================
+ Hits         2733     2745      +12     
- Misses       1559     1560       +1     
  Partials        9        9              
Files Coverage Δ
src/state/atoms/releaseAtom.ts 100.00% <100.00%> (ø)
src/state/atoms/utils.ts 100.00% <100.00%> (ø)
src/state/chromeStore.ts 100.00% <100.00%> (ø)
src/components/Header/Tools.tsx 63.76% <0.00%> (-0.94%) ⬇️

@Hyperkid123 Hyperkid123 merged commit 3061e10 into RedHatInsights:master May 10, 2024
7 of 9 checks passed
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.

3 participants