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

[Table]开启虚拟滚动后表格回显异常 #4453

Closed
callmeYe opened this issue Oct 8, 2023 · 9 comments
Closed

[Table]开启虚拟滚动后表格回显异常 #4453

callmeYe opened this issue Oct 8, 2023 · 9 comments
Labels
Stale not active for a lone time ❓ Usage It's about how it works

Comments

@callmeYe
Copy link

callmeYe commented Oct 8, 2023

Component

Table

Steps to reproduce

import { Table, Field, Button } from '@alifd/next';
import React, { useState, useEffect } from 'react'
import ReactDOM from 'react-dom'

const dataSource = () => {
const result = [];
for (let i = 0; i < 5; i ) {
result.push({
title: {name: Quotation for 1PCS Nano ${3 i}.0 controller compatible},
id: 100306660940 i,
time: 2000 i
});
}
return result;
};
const render = (value, index, record) => {
return Remove({record.id});
};

export default function Demo() {
const field = Field.useField();
const { init } = field;
const [step,setStep]= useState(1);

useEffect(() => {
field.setValue('ds', dataSource());
field.setValue('myinput2', 'my input text2');

}, [])

return (


<Button onClick={()=>{setStep(1);}}>setStep 1

  <Button onClick={()=>{setStep(2);}}>setStep 2</Button>

  <div
  style={{display: step===1 ? 'block':'none'}}
  >current step1
  </div>

{
// step===2 &&

current step2
}
</div>

);
}

ReactDOM.render(, document.getElementById("root"))

@eternalsky
Copy link
Contributor

异常表现是什么?

@eternalsky eternalsky added the Insufficient information Further information is requested label Oct 11, 2023
@github-actions
Copy link

你好 @callmeYe,由于缺乏必要的信息(如 bug 重现步骤、复现 demo 等),无法定位问题。请补充相应的信息以帮助我们更快地定位问题。复现 demo 可以是 codesandboxcodepen 或是 GitHub 仓库的链接。在相关 label 移除之前,由于无法快速跟进我们将降低处理的优先级。

@callmeYe
Copy link
Author

异常表现是数据无法回显

@YSMJ1994
Copy link
Contributor

异常表现是数据无法回显

你好,麻烦提供最小复现demo和复现路径( codesandboxcodepen )以便我们理解并排查问题

@callmeYe
Copy link
Author

最小复现代码已经给出

@YSMJ1994
Copy link
Contributor

YSMJ1994 commented Oct 19, 2023

最小复现代码已经给出

你给得代码粘贴出来都是语法错误...麻烦给个( codesandboxcodepen ) 吧
最好也能给一下复现步骤,以及预期,以便我们能快速理解你的问题

@callmeYe
Copy link
Author

@YSMJ1994 YSMJ1994 added Next release issues to close in next release and removed Insufficient information Further information is requested labels Nov 10, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in DAILY WORK Nov 10, 2023
@YSMJ1994 YSMJ1994 added the 🐞 Bug Something isn't working label Nov 10, 2023
@YSMJ1994 YSMJ1994 removed this from DAILY WORK Nov 13, 2023
@YSMJ1994
Copy link
Contributor

@callmeYe 排查到问题是开启虚拟滚动后,会检测容器的尺寸进行滚动计算,你的demo初始状态为display: none,导致无法获取到容器尺寸,后续的状态变更也没有触发table props变化进入了缓存逻辑,导致计算过程没有再次执行。
这种情况建议你通过 step 值来动态渲染table节点,而非通过 display 隐藏,或者step更新时给table 传递一个不一样的key来让其重载

@YSMJ1994 YSMJ1994 added ❓ Usage It's about how it works and removed 🐞 Bug Something isn't working Next release issues to close in next release labels Dec 7, 2023
@YSMJ1994 YSMJ1994 removed their assignment Dec 7, 2023
@YSMJ1994 YSMJ1994 added the Stale not active for a lone time label Jan 12, 2024
@YSMJ1994
Copy link
Contributor

Stale

@YSMJ1994 YSMJ1994 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale not active for a lone time ❓ Usage It's about how it works
Projects
None yet
Development

No branches or pull requests

4 participants