Skip to content

Commit

Permalink
refactor: remove dev comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxFrank13 committed Dec 18, 2023
1 parent 7fa76d7 commit 3dda7d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 24 deletions.
Binary file removed edx-frontend-plugin-framework-0.1.0.tgz
Binary file not shown.
18 changes: 5 additions & 13 deletions src/plugins/Plugin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ const ErrorFallbackDefault = ({ intl }) => (
</h2>
</div>
);
// NOTES:
// I changed the errorFallBackProp to ErrorFallbackComponent
// It is now capitalized to signify that it is a react component
// The name is changed for the same reason
// The reason why I wanted to make this clear is because the <ErrorBoundary /> component
// from frontend-platform wouldn't render anything unless it was provided
// as a React Component (ie. <ErrorFallback />) see this below in the final render of <Plugin />

// TODO: find out where "ready" comes from
const Plugin = ({
children, className, intl, style, ready, ErrorFallbackComponent,
}) => {
Expand All @@ -46,7 +41,6 @@ const Plugin = ({

// Need to confirm: When an error is caught here, the logging will be sent to the child MFE's logging service

// NOTES: capitalized here for same reason — it's not necessary but helps devs remember
const ErrorFallback = ErrorFallbackComponent || ErrorFallbackDefault;

useHostEvent(PLUGIN_RESIZE, ({ payload }) => {
Expand All @@ -65,6 +59,7 @@ const Plugin = ({
}, []);

useEffect(() => {
// TODO: find out where "ready" comes from and when it would be true
if (ready) {
dispatchReadyEvent();
}
Expand All @@ -73,11 +68,8 @@ const Plugin = ({
return (
<div className={className} style={finalStyle}>
<ErrorBoundary
// NOTES:
// If the prop provided here is not in React Component format (<ComponentName ...props />)
// then it won't be rendered to the page
// TODO: update frontend-platform code to refactor this
// or include info in docs somewhere
// Must be React Component format (<ComponentName ...props />) or it won't render
// TODO: update frontend-platform code to refactor <ErrorBoundary /> or include info in docs somewhere
fallbackComponent={<ErrorFallback intl={intl} />}
>
{children}
Expand Down
11 changes: 0 additions & 11 deletions src/plugins/PluginSlot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@ const PluginSlot = forwardRef(({
*/
const { plugins, keepDefault } = usePluginSlot(id);

// NOTES:
// This is now "loadingFallback" to better show what it is used for
// This fallback will be rendered the page while the PLUGIN_READY value is false
// PLUGIN_READY event is fired when the Plugin component mounts
// If no components wrapped in Plugin are provided in the iframed component, this event will never fire
// And thus the spinner will remain on the screen with no indication to the viewer
// This is important to note when creating Plugins — perhaps a PluginWrapper component should be encouraged?
// Similar to what is used in the test files
// This is also what happens with errors handled by ErrorBoundary —
// If the code that errors is not wrapped in a Plugin component,
// then the error will bubble up to the ErrorBoundary in AppProvider (every MFE is wrapped in <AppProvider />)
const { loadingFallback } = pluginProps;

const defaultLoadingFallback = (
Expand Down

0 comments on commit 3dda7d4

Please sign in to comment.