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

poc: zustand state with mocking in playground #445

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

abhinavrastogi-harness
Copy link
Collaborator

@abhinavrastogi-harness abhinavrastogi-harness commented Nov 14, 2024

this is a contrived, but working example of how we can achieve a few things:

  1. define view state entirely in the views package, along with callbacks for any user interactions
  2. playground can pass in mock data very simply, with no dependence on zustand or any other state management library
  3. gitness can implement the same strongly-typed interface in a zustand store to implement encapsulated business logic
  4. includes a sample for a different API which hides the zustand store contract from the component

Here's a real-world example of hwo complex a data store can get for a single page: https://github.com/harness/canary/pull/433/files#diff-5be8368c828f150a436361aa4a6c239c1e3febde07d493f85938a663ea3c6d3f

Passing ALL these values and methods as separate props could be very verbose.

Copy link

netlify bot commented Nov 14, 2024

Deploy Preview for harness-xd-review ready!

Name Link
🔨 Latest commit d9aa52e
🔍 Latest deploy log https://app.netlify.com/sites/harness-xd-review/deploys/67365a81860ac80008cc09d0
😎 Deploy Preview https://deploy-preview-445--harness-xd-review.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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.

1 participant