feat(core, react): Supports dynamic import for activities, and delays transition effects while loading an activity or waiting for a loader response#542
Conversation
🦋 Changeset detectedLatest commit: 9eee5a8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
React.lazy() to fetch an activity or when the loader is currently pending state. React.lazy() to fetch an activity or when the loader is currently pending state.
React.lazy() to fetch an activity or when the loader is currently pending state. |
(참고) |
There was a problem hiding this comment.
I'm really appreciating your works for the tricky issue.
Here's a question:
Is PausedEvent and ResumedEvent allowed to be made by the 3rd-party users working with the plugins other than the integrations?
If so, please consider adding the hook interfaces for the plugin. (onBeforePaused, ...)
If not, hide those as internal events and block the event creation from calling dispatchEvent.
|
@orionmiz I just finished reflecting your review, please review again. |
integrations/react/src/__internal__/LazyActivityComponentType.ts
Outdated
Show resolved
Hide resolved
627d160 to
25b163b
Compare
25b163b to
60479a6
Compare
New Event (Core)
PausedEventandResumedEventto delay the effect of transitions.New Interface (React)
lazy(() => import(“...”)), emit aPausedEventbefore importing the Activity and aResumedEventif the Activity is successfully imported or an error occurs.PausedEventbefore executing the loader and aResumedEventwhen the loader state resolves.Why does it have to be of the form
lazy(() => import(“...”))?Other candidates considered
React.lazyor not. To find out, we'd have to float it in the React environment, which we decided was an unnecessary overhead.Promiseor aReact.ReactNode.Therefore, I introduced a new construct
lazy()that allows to statically evaluate whether the currently passed argument requires lazy loading or not.