Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Destination Sample Record Card exports and updates precisely #3071

Merged
merged 8 commits into from Mar 4, 2022

Conversation

krishnaglick
Copy link
Contributor

@krishnaglick krishnaglick commented Mar 2, 2022

Change description

Destination now asks to be saved before allowing user to export.
The singular Export call is now sync.
The sample record call dynamically updates as you map/unmap properties or change groups
Improved testing a touch

Checklists

Development

  • Application changes have been tested appropriately

Impact

  • Code follows company security practices and guidelines
  • Security impact of change has been considered
  • Performance impact of change has been considered
  • Possible migration needs considered (model migrations, config migrations, etc.)

Please explain any security, performance, migration, or other impacts if relevant:

Code review

  • Pull request has a descriptive title and context useful to a reviewer. Screenshots or screencasts are attached where applicable.
  • Relevant tags have been added to the PR (bug, enhancement, internal, etc.)

@krishnaglick krishnaglick added the bug Something isn't working label Mar 2, 2022
const canExportRecord = useMemo(
() => destinations?.find(({ id }) => id === destinationId),
() => !!destinations?.find(({ id }) => id === destinationId),
Copy link
Contributor

Choose a reason for hiding this comment

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

The canExportRecord flag seems to indicate whether to add the button or not. Would it make sense to check if there is a destinationId defined here and then avoid having to check below for destinationId to render the button or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding a short-circuit here

@@ -366,6 +366,176 @@ const SampleRecordCard: React.FC<SampleRecordCardProps> = ({
setExporting(false);
}, [client, destinationId, record?.id]);

const content = useMemo(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hard to compare with the one below because of the move. Did anything change in particular or just move up/memoizing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment around the new bit.

@@ -413,10 +583,12 @@ const SampleRecordCard: React.FC<SampleRecordCardProps> = ({
);
}

if (canExportRecord) {
if (destinationId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

As mentioned above, if the canExportRecord memo checks for destinationId, then this can go back to the way it was. Using canExportRecord over destinationId seems less arbitrary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Brian wanted the button always visible on the Destination page.

const canExportRecord = useMemo(
() => destinations?.find(({ id }) => id === destinationId),
() => !!destinations?.find(({ id }) => id === destinationId),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding a short-circuit here

<p>You need to map a property to see your sample record.</p>
</Col>
</Row>
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This bit here is new.

@@ -366,6 +366,176 @@ const SampleRecordCard: React.FC<SampleRecordCardProps> = ({
setExporting(false);
}, [client, destinationId, record?.id]);

const content = useMemo(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment around the new bit.

Copy link
Contributor

@edmundito edmundito left a comment

Choose a reason for hiding this comment

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

Looks good. There's just a copy fix but I'm happy with the code.

ui/ui-components/components/record/SampleRecordCard.tsx Outdated Show resolved Hide resolved
@krishnaglick krishnaglick force-pushed the 180984244-destination-sample-record-card branch from 40780c4 to e28d9d5 Compare March 4, 2022 14:11
@krishnaglick krishnaglick enabled auto-merge (squash) March 4, 2022 14:16
@krishnaglick krishnaglick merged commit ece0563 into main Mar 4, 2022
@krishnaglick krishnaglick deleted the 180984244-destination-sample-record-card branch March 4, 2022 14:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants