fix(www): make embed view-only and save acknowledgement reliable - #41
Open
DavidBabinec wants to merge 1 commit into
Open
DavidBabinec wants to merge 1 commit into
DavidBabinec wants to merge 1 commit into
Conversation
The hosted editor at coreframework.com/app opens public projects with isViewOnly, but the editor removed the save buttons from the DOM while its loader was still showing, so they rendered anyway and Cmd/Ctrl+S still saved. View-only is now an atom that hides both buttons and skips the save. After a save the editor waited for cf-push-response with a one-shot listener, so any other message reaching the window first used it up and the host's answer was dropped. It now ignores unrelated messages and treats no answer within 30 seconds as a failure. The clipboard read uses the same helper.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
In the hosted editor (coreframework.com/app, which embeds www in an iframe), View Only still showed both Save buttons and saved on Cmd/Ctrl+S. A save could also finish with no "Saved successfully" and no error. Both exist in 1.10.4 too.
Why
View Only removed
#push1/#push2from the DOM while the loader was still showing, so the buttons rendered afterwards anyway. The save waited forcf-push-responsewith a{ once: true }listener, so any earlier message used it up. View Only is now an atom that hides the buttons and skips the save. The reply wait ignores other messages and times out after 30s.Checked against the website's
src/pages/app/[slug].tsxand 1.10.4: no message was dropped or renamed, and the embed never used the removedx-api-keyimporter.Verification
Live, through a host page mirroring
[slug].tsx: a save captured from the live 1.10.4 bundle loaded and re-saved in 2.x. View Only hid Save and ignored Cmd+S; a message sent before the reply swallowed the toast on main but not here. Failure replies and clipboard paste work.