Share a2ui - #151
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a feature to share designs in the A2UI Composer by compressing and encoding the active JSON payload into a URL-safe Base64 string using deflate-raw. It adds a 'Share design' button to copy the shareable URL, updates startup resolution to parse and load the shared payload, and includes comprehensive tests. The review feedback suggests hardening the utility methods in QueryParser with guard clauses for nullish or undefined inputs, adding corresponding unit tests, avoiding potential call stack overflow issues when converting large buffers, and refactoring direct globalThis references in ComposerShell to use Angular's injected DOCUMENT token.
⚡ A2UI Composer PR PreviewYour automated preview is successfully live (commit
|
sugoi-yuzuru
left a comment
There was a problem hiding this comment.
So, it seems we are doing compress->base64 to URL-firendly stringifying the JSON.
While this is super nice feature, many messaging apps trucate URLs at 2000 chars, and many legacy browsers have a hard cap on how long a URL can be.
Are there any plans for safe-guarding the user from assuming all sharable links will be reliably translated in the same view?
E.g., if the image component happens to already contain a base64 encoded image data, it is very likely that this shared link will break.
Diagnose decompression and JSON parsing failures in QueryParser to detect payload truncation from URL length limits, malformed JSON syntax, or unrecognized encodings. Expose the diagnosis via StartupResolution and display an informative error snackbar in ComposerShell.
Thanks for catching this! I've added checks for this situation, and will popup a notification to the user now if the incoming A2UI JSON is invalid. |
Description
Add a "share" button which generates a URL that can be shared. When opened, the A2UI JSON editor is populated with the same A2UI, and the preview renders it. The renderer used is also passed.
See https://screencast.googleplex.com/cast/NTI0Mzg5MjEyNjQ0OTY2NHw2YzA3ZjFiMy1jYQ. (Note that after clicking the "New Session", what you can't see is that I'm going to the URL bar and pasting the URL that the share button saved to the clipboard.)
Pre-launch Checklist