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

Address useRef in TableResultsEntities component #1810

Open
tjmadonna opened this issue Jan 30, 2025 · 1 comment · Fixed by #1892 · May be fixed by #1893
Open

Address useRef in TableResultsEntities component #1810

tjmadonna opened this issue Jan 30, 2025 · 1 comment · Fixed by #1892 · May be fixed by #1893
Assignees

Comments

@tjmadonna
Copy link
Contributor

I get occasional errors while running the portal locally. I believe it's caused by the conditional ref.

currentColumns = currentColumns || useRef([])

Image

@tjmadonna tjmadonna added this to CODCC Jan 30, 2025
@tjmadonna tjmadonna converted this from a draft issue Jan 30, 2025
@libpitt
Copy link
Contributor

libpitt commented Feb 27, 2025

Hmm. Yes. So the collections/Datasets.jsx needed to have its own ref. A ref was used in the first place instead of regular JS array for value persistence.

Anyhow a possible fix for this would be to remove the condition.

function TableResultsEntities({children, filters, onRowClicked, currentColumns,...}) {
:
const _currentColumns = useRef([])
:

// Then have:
setCurrentColumns = (cols) => {
	if (currentColumns) {
		currentColumns.current = cols
	} else {
		_currentColumns.current = cols
	}
}

getCurrentColumns = () => currentColumns.current || _currentColumns.current

But I cannot reproduce the problem. Don't want to implement a blind solution.

I do think the whole table has gotten out of hand with all the customizations. Wish antd.Table was known before it all.

@tjmadonna

@tjmadonna tjmadonna moved this from Backlog to In Progress in CODCC Feb 27, 2025
@tjmadonna tjmadonna self-assigned this Feb 27, 2025
@tjmadonna tjmadonna linked a pull request Feb 27, 2025 that will close this issue
@tjmadonna tjmadonna moved this from In Progress to Review/QA in CODCC Feb 27, 2025
@maxsibilla maxsibilla linked a pull request Feb 28, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review/QA
2 participants