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

188300239 Fix joining with a new table #102

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ export default class App extends Component {
const handleDataContextChange = (event: ChangeEvent<HTMLSelectElement>) => this.handleDataContextChange(event);
const initiateShare = (selectedContext?: string) => {
if (selectedContext) this.setState({ selectedDataContext: selectedContext });
this.initiateShare()
this.initiateShare();
};
const joinShare = (selectedContext?: string) => {
if (selectedContext) this.setState({ selectedDataContext: selectedContext });
this.joinShare()
}
this.joinShare();
};

const availableContextOptions = availableDataContexts.map((dc: DataContext) =>
<option key={dc.name} value={dc.name}>{dc.title ?? dc.name}</option>
Expand Down
2 changes: 1 addition & 1 deletion src/ui-pages/join-without-merging.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const JoinWithoutMerging = (props: JoinWithoutMergingProps) => {
</button>
<button
disabled={!joinShareId || (!personalDataLabel && !lastPersonalDataLabel)}
onClick={joinShare}>
onClick={() => joinShare()}>

Choose a reason for hiding this comment

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

Would it be a little better to not use the anonymous function and keep this as onClick={joinShare}?

In a previous change, it looks like you added the anonymous function so you could pass an argument. But you're no longer passing an argument here, so maybe it's not necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was quite surprised, but the change from () => joinShare() to joinShare is what caused the bug. I now realize that when it's just joinShare, the click event gets passed to joinShare as an argument, which the function definitely wasn't prepared to handle.

Choose a reason for hiding this comment

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

I see. Good to know.

{BEGIN_COLLABORATION}
</button>
</div>
Expand Down
Loading