-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Core: Refactor preview rendering out of PreviewWeb
#17598
Conversation
☁️ Nx Cloud ReportCI ran the following commands for commit 9068d88. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
397d4f8
to
338d516
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you document the control flow somewhere? It seems like there are a few different layers of indirection now and I'm having trouble following.
|
||
private canvasElement?: CanvasElement; | ||
|
||
private context?: DocsContextProps; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the type DocsContextProps
make sense anymore? seems something like DocsContext
might be more appropriate (tho that's probably taken)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was just mainly moving stuff around but it did occur to me that name was a bit "unexpected".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it seems to be called that all over the place so I'm inclined to leave it in this refactor
338d516
to
761aea9
Compare
PreviewWeb
PreviewWeb
Precursor to #17214
What I did
Pulled the rendering part of
PreviewWeb
out into two classes:StoryRender
andDocsRender
.StoryRender
handles the job of "preparing" (ie.import
-ing) the storyDocsRender
modernInlineRender
callsrenderStoryToElement
(one or more times on the docs page), this also creates additionalStoryRender
s.Preview
simply "multiplexes" channel messages that drive re-renders to theStoryRender
s andDocRender
that are on the screen.Some notes:
In any case this PR is not intended to change functionality, just refactor.
How to test
See existing tests. I also added some for checking the re-rendering behaviour in
modernInlineRender
docs mode.