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: progress bar in my sites #1189

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

luke-mcfarlane-rocketlab
Copy link
Contributor

@luke-mcfarlane-rocketlab luke-mcfarlane-rocketlab commented Oct 23, 2024

JIRA Ticket

BSS-375

Description

Added progress bar to sites table in mobile view.

Proposed Changes

  • created queries to get

How to Test

Additional Information

Checklist

  • I have confirmed all commits have been signed.
  • I have added JSDoc style comments to any new functions or classes.
  • Relevant documentation such as READMEs, guides, and class comments are updated.

Copy link
Contributor

@PeterBaker0 PeterBaker0 left a comment

Choose a reason for hiding this comment

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

Doesn't work currently as useQuery in the render function causes React error e.g.

image

app/src/gui/components/notebook/record_table.tsx Outdated Show resolved Hide resolved
app/src/gui/components/notebook/record_table.tsx Outdated Show resolved Hide resolved
Signed-off-by: Luke McFarlane <[email protected]>
@luke-mcfarlane-rocketlab
Copy link
Contributor Author

@PeterBaker0 issues above resolved

Copy link
Contributor

@PeterBaker0 PeterBaker0 left a comment

Choose a reason for hiding this comment

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

Mildly concerned about performance implications of fetching all data for all entries in the record list on every remount. Also not sure on layout efficiency - want to wait until Ranisa's PRs are resolved to see how it could fit in updated layout.

Comment on lines 452 to +480
useEffect(() => {
const getData = async () => {
try {
if (query.length === 0) {
const ma = await getMetadataForAllRecords(
props.project_id,
props.filter_deleted
);
setPouchData(ma);
} else {
const ra = await getRecordsWithRegex(
props.project_id,
query,
props.filter_deleted
const records = (
query.length === 0
? await getMetadataForAllRecords(
props.project_id,
props.filter_deleted
)
: await getRecordsWithRegex(
props.project_id,
query,
props.filter_deleted
)
) as RecordMetaDataExtended[];

for (const record of records) {
const data = await getFullRecordData(
record.project_id,
record.record_id,
record.revision_id
);
setPouchData(ra);

if (!data) continue;

record.record = data;
}

setPouchData(records);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this is probably going to conflict with my pending PR #1199 which moves this into a react query - but that's okay we can fix it up

Comment on lines +468 to 473
for (const record of records) {
const data = await getFullRecordData(
record.project_id,
record.record_id,
record.revision_id
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Performance concerns here possibly - but we'll see.

Copy link
Contributor

Choose a reason for hiding this comment

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

For the PR to display summary fields in the record table we'll be grabbing the whole record data so this would not be necessary. A few interacting changes going on here. Can this be deferred?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can defer this one

Copy link
Contributor

Choose a reason for hiding this comment

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

cool - I think there is a space for hooks already though

@stevecassidy
Copy link
Contributor

Not what you're doing here but your earlier progress bar breaks the rules by updating the parent component (Record) while rendering the child RecordForm. The call to setProgress in RecordForm.render is the problem, it needs to move out of render and into one of the other methods. See the console when you render a form for the warning.

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

Successfully merging this pull request may close these issues.

3 participants