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

✨ Feat: ErrorBoundary refactored for Production #1583

Open
wants to merge 12 commits into
base: 3.3.0
Choose a base branch
from

Conversation

b-l-i-n-d
Copy link
Collaborator

No description provided.

@b-l-i-n-d b-l-i-n-d added the v3.3.0 Tutor 3.3.0 label Feb 10, 2025
@b-l-i-n-d b-l-i-n-d marked this pull request as ready for review February 11, 2025 10:22
Copy link
Collaborator

@sazedul-haque sazedul-haque left a comment

Choose a reason for hiding this comment

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

A better approach would be creating two different files and import dynamically. This will reduce production bundle size and produce cleaner code. We can create an ErrorBoundaryWrapper like the example bellow which will server the desired component.

import React, { ReactNode } from "react";

let ErrorBoundary: React.ComponentType<{ children: ReactNode }>;

if (process.env.NODE_ENV === "development") {
  ErrorBoundary = require("@TutorShared/components/ErrorBoundaryDev").default;
} else {
  ErrorBoundary = require("@TutorShared/components/ErrorBoundaryProd").default;
}

export default ErrorBoundary;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3.3.0 Tutor 3.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants