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

IframeContentRenderer: formalize iframe communication #1565

Open
wants to merge 13 commits into
base: feature/editor-preview-cleanup
Choose a base branch
from

Conversation

jeremywiebe
Copy link
Collaborator

Summary:

This PR introduces a formal messaging system with Typescript types to define each message passing between the editor and iframe preview page. This enables us to more easily see how the communication flows and ensures we know what data is expected on both ends.

Issue: LEMS-1809

Test plan:

yarn tsc
yarn test

@jeremywiebe jeremywiebe self-assigned this Aug 27, 2024
@jeremywiebe jeremywiebe requested a review from a team August 27, 2024 18:43
@jeremywiebe jeremywiebe marked this pull request as draft August 27, 2024 18:43
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Aug 27, 2024

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/proud-baboons-warn.md, packages/perseus-editor/src/article-editor.tsx, packages/perseus-editor/src/hint-editor.tsx, packages/perseus-editor/src/iframe-content-renderer.tsx, packages/perseus-editor/src/iframe-utils.ts, packages/perseus-editor/src/index.ts, packages/perseus-editor/src/item-editor.tsx, packages/perseus-editor/src/__tests__/iframe-content-renderer.test.tsx, packages/perseus-editor/src/__tests__/iframe-utils.test.ts, packages/perseus-editor/src/__tests__/__snapshots__/iframe-content-renderer.test.tsx.snap

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

@jeremywiebe jeremywiebe force-pushed the jer/editor-preview-11 branch from b155429 to 9e61e0f Compare August 27, 2024 18:45
Copy link
Contributor

github-actions bot commented Aug 27, 2024

Size Change: +977 B (+0.11%)

Total Size: 860 kB

Filename Size Change
packages/perseus-editor/dist/es/index.js 276 kB +977 B (+0.35%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.3 kB
packages/keypad-context/dist/es/index.js 760 B
packages/kmath/dist/es/index.js 4.27 kB
packages/math-input/dist/es/index.js 78 kB
packages/math-input/dist/es/strings.js 1.79 kB
packages/perseus-core/dist/es/index.js 1.48 kB
packages/perseus-linter/dist/es/index.js 22.2 kB
packages/perseus/dist/es/index.js 417 kB
packages/perseus/dist/es/strings.js 3.36 kB
packages/pure-markdown/dist/es/index.js 3.66 kB
packages/simple-markdown/dist/es/index.js 12.4 kB

compressed-size-action

Copy link

codecov bot commented Aug 27, 2024

Codecov Report

Attention: Patch coverage is 87.69231% with 32 lines in your changes missing coverage. Please review.

Project coverage is 71.27%. Comparing base (b4b9430) to head (3a0a245).

Files with missing lines Patch % Lines
packages/perseus-editor/src/iframe-utils.ts 88.95% 19 Missing ⚠️
...ges/perseus-editor/src/iframe-content-renderer.tsx 85.89% 11 Missing ⚠️
packages/perseus-editor/src/article-editor.tsx 0.00% 1 Missing ⚠️
packages/perseus-editor/src/item-editor.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@                        Coverage Diff                         @@
##           feature/editor-preview-cleanup    #1565      +/-   ##
==================================================================
+ Coverage                           70.31%   71.27%   +0.95%     
==================================================================
  Files                                 521      525       +4     
  Lines                              107245   107437     +192     
  Branches                             7799    11062    +3263     
==================================================================
+ Hits                                75408    76571    +1163     
+ Misses                              31652    30866     -786     
+ Partials                              185        0     -185     

Impacted file tree graph

Files with missing lines Coverage Δ
packages/perseus-editor/src/hint-editor.tsx 87.19% <100.00%> (-0.03%) ⬇️
packages/perseus-editor/src/index.ts 100.00% <100.00%> (ø)
packages/perseus-editor/src/article-editor.tsx 13.22% <0.00%> (+0.03%) ⬆️
packages/perseus-editor/src/item-editor.tsx 30.18% <50.00%> (+0.18%) ⬆️
...ges/perseus-editor/src/iframe-content-renderer.tsx 86.57% <85.89%> (+8.98%) ⬆️
packages/perseus-editor/src/iframe-utils.ts 88.95% <88.95%> (ø)

... and 140 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b4b9430...3a0a245. Read the comment docs.

@jeremywiebe jeremywiebe marked this pull request as ready for review August 27, 2024 21:33
@jeremywiebe jeremywiebe reopened this Aug 27, 2024
Copy link
Contributor

github-actions bot commented Aug 27, 2024

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (12ecccd) and published it to npm. You
can install it using the tag PR1565.

Example:

yarn add @khanacademy/perseus@PR1565

If you are working in Khan Academy's webapp, you can run:

./dev/tools/bump_perseus_version.sh -t PR1565

@jeremywiebe jeremywiebe force-pushed the jer/editor-preview-10 branch from 3d6f3ad to 25fedd1 Compare August 28, 2024 17:11
@jeremywiebe jeremywiebe changed the base branch from jer/editor-preview-10 to feature/editor-preview-cleanup August 28, 2024 17:51
@jeremywiebe jeremywiebe force-pushed the jer/editor-preview-11 branch from 8e065e6 to 3121602 Compare August 28, 2024 17:53
Comment on lines -276 to -277
datasetKey="mobile"
datasetValue={isMobile}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We only ever passed "mobile" here, so I've encoded that as a single prop instead of this generic key/value pair. This will make it easier to understand on the consuming side also (webapp).

@jeremywiebe jeremywiebe force-pushed the jer/editor-preview-11 branch 2 times, most recently from a0a975f to 3a0a245 Compare August 29, 2024 22:36
@jeremywiebe jeremywiebe force-pushed the feature/editor-preview-cleanup branch from b4b9430 to 16550a5 Compare September 5, 2024 00:36
@jeremywiebe jeremywiebe force-pushed the jer/editor-preview-11 branch from 3a0a245 to 12ecccd Compare September 5, 2024 00:37
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