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

PayloadDecoder #1651

Merged
merged 22 commits into from
Oct 17, 2023
Merged

PayloadDecoder #1651

merged 22 commits into from
Oct 17, 2023

Conversation

Alex-Tideman
Copy link
Contributor

@Alex-Tideman Alex-Tideman commented Sep 26, 2023

Description & motivation 💭

Use the PayloadDecoder component to decode payloads and pass to the CodeBlock instead of decoding everything upfront.

The PayloadDecoder accepts PotentiallyDecodable | EventAttribute | WorkflowEvent as a value. It will iterate over the value and decode each payload. You can also pass a key prop to return a value of the decoded object. This is mostly to not show { payloads: "thing" } and instead show "thing".

There is no caching of decoded values. So when a PayloadDecoder is rerendered, it will send another decode request. It is up to the codec server implementation to handle caching.

⚠️ THIS PR REMOVES SUPPORT FOR WEBSOCKET PORT DECODING.

Screenshots (if applicable) 📸

Design Considerations 🎨

Testing 🧪

How was this tested 👻

  • Manual testing
  • E2E tests added
  • Unit tests added

Steps for others to test: 🚶🏽‍♂️🚶🏽‍♀️

Checklists

Draft Checklist

Merge Checklist

Issue(s) closed

Docs

Any docs updates needed?

rossedfort and others added 7 commits September 13, 2023 14:01
* make prettier and eslint play nice

* add lint:ci so will fail in ci

* format all the files

* organize imports on save

* update snaps from tailwind class order changes

* update snaps

* add recommended extensions

* pr feedback
* Use CodeMirror for event history payloads

* Add readonly prop

* WIP: add copy icon to copy content in JSONEditor

* Make codemirror the new CodeBlock. Need to figure out string new lines and how to update editor on content changes

* Add folding, make string the type for content, update styles, make dynamic, remove PRISM

* Fix extra stringifying

* Fix small issues

* Remove null check

* Use margin

* Fix CodeBlock testid

* Add editable class to codeblock

* Fix playwright payload tests, better extension logic to prevent lineWrapping on inline codeblocks

* Make it more readable, add back storageState
@vercel
Copy link

vercel bot commented Sep 26, 2023

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
holocene ⬜️ Ignored (Inspect) Visit Preview Oct 16, 2023 9:40pm

@Alex-Tideman Alex-Tideman changed the title WIP: PayloadDecoder PayloadDecoder Oct 13, 2023
@Alex-Tideman Alex-Tideman marked this pull request as ready for review October 13, 2023 15:45
copySuccessIconTitle={translate('copy-success-icon-title')}
/>
{#if decodeEventHistory}
{#key [index, decodeEventHistory]}
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL you can do array keys. is the decodeEventHistory necessary so that we re-render encoded/decoded payloads when the switch is toggled on and off?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup exactly

@Alex-Tideman Alex-Tideman merged commit d2988c6 into main Oct 17, 2023
9 checks passed
@Alex-Tideman Alex-Tideman deleted the decodable-code-block branch October 17, 2023 17:18
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.

2 participants