ionic-team / ionic-team/ionic-framework

bug: ion-loading doesn't wait for page transition to finish before dismissing

未关闭
#24,292 8 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
package: core type: bug
主要语言
TypeScript
星标
52.7k
派生
13.3k
平均合并
1 天 14 小时
30 天内合并 PR
50

描述

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already include this feature request, without success.

### Describe the Feature Request

I would like some guidance on how to incorporate [React Suspense](https://reactjs.org/docs/concurrent-mode-suspense.html) into an Ionic React project.

### Describe the Use Case

When using [React Suspense](https://reactjs.org/docs/concurrent-mode-suspense.html) to suspend the loading of the contents of a page, I run into an issue where the page's transition breaks since there is no `IonContent` in the mounted page. Once the suspense resolves and the `IonContent` is mounted, the animation then works correctly. This is not an issue for pages that do not have a footer, since the entire suspense wrapper could be wrapped with an `IonContent` as below:

```

}>
{RandomComponent ? : }

```

The issue then arises when you have a page that has an `IonFooter` since this sits outside the `IonContent` wrapper so you cannot wrap the suspended component in an `IonContent`.

To demonstrate this problem in more detail please check out this demonstration:
https://codesandbox.io/s/nostalgic-platform-qfwqv

### Describe Preferred Solution

Preferably, there would be a component which is able to wrap the `IonContent` and `IonFooter` so that the entire page content can be suspended and lazy-loaded such as the solution below:

Page.tsx
```
const PageContent = React.lazy(() => (import('./PageContent')))

function Page {
return (


...


}>
{ }


)
}
```

PageContent.tsx
```
<>

...


...

```

I am open to any other alternatives you have to solve this issue.

### Describe Alternatives

_No response_

### Related Code

_No response_

### Additional Information

_No response_

贡献指南

打开贡献指南

调研方向

从链接的 CodeSandbox 开始,比较使用 React Suspense、IonContent、IonFooter 和 IonLoading 的 Page.tsx 与 PageContent.tsx 示例。确定 wrapper 是否可以在保留过渡效果的同时 suspend 整个页面,并定义有 footer 和没有 footer 的页面的预期行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
react, typescript
领域
frontend
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。