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

create dynamic component use fallback props #2031

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@xarc/react",
"comment": "use fallback props in create Dynamic component",
"type": "patch"
}
],
"packageName": "@xarc/react"
}
2 changes: 1 addition & 1 deletion packages/xarc-react/src/common/create-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class SubAppComponent extends Component {
this._options = props.__options;
this.resolveName = this._options.resolveName || this.subapp.resolveName;
this.state = this.makeState();
this.loading = <div>subapp {this.subapp.name} component loading... </div>;
this.loading = this._options.fallback || <div>subapp {this.subapp.name} component loading... </div>;
this._info = { component: this, subapp: props.__subapp, type: "dynamic" };
this.subapp._mount(this._info);
}
Expand Down
2 changes: 1 addition & 1 deletion samples/subapp2-poc/src/static.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { xarcV2 } from "@xarc/react";
import { demo1 } from "./home";
import custom from "./styles/custom.module.css"; // eslint-disable-line no-unused-vars

const Demo1 = createDynamicComponent(demo1, { ssr: true });
const Demo1 = createDynamicComponent(demo1, { ssr: true, fallback: <div>Loading...</div>});

xarcV2.debug("static.tsx");
const StaticHome = props => {
Expand Down
Loading