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

fix x verified link #602

Merged
merged 2 commits into from
Oct 6, 2023
Merged

fix x verified link #602

merged 2 commits into from
Oct 6, 2023

Conversation

waelhanfi04
Copy link
Contributor

This pull request addresses an issue related to the xLink and xLinkSpinner conditions in the code. The conditions are used to determine when to display a spinner based on the value of the url field in a form.

The issue being addressed is related to the condition checks. In the current code, the conditions are based on the following logic:

xLink: The spinner is not displayed (!spinner) if the url value starts with 'https://x.com/'.
xLinkSpinner: The spinner is displayed (spinner) if the url value starts with 'https://x.com/'.
However, there's a potential problem with this logic. If the url value doesn't exist (is null or undefined), the code may throw an error when trying to access .indexOf('https://x.com/') on a non-existent value.

To address this issue, I have updated the code to include a check for the existence of the url value before performing the .indexOf operation. Here's the updated code:

javascript
Copy code
xLink:
!spinner &&
sendform
.get('url')
?.value?.startsWith('https://x.com/') === true,
xLinkSpinner:
spinner &&
sendform
.get('url')
?.value?.startsWith('https://x.com/') === true,
By adding the check ?.value?.startsWith('https://x.com/') === true, we ensure that the code will only perform the .startsWith operation if the url value is defined and not null. This change should prevent any potential errors related to accessing properties on undefined values.

@waelhanfi04 waelhanfi04 linked an issue Oct 5, 2023 that may be closed by this pull request
@hichri-louay hichri-louay merged commit ab399a0 into develop Oct 6, 2023
3 checks passed
@hichri-louay hichri-louay deleted the getgain branch October 6, 2023 15:08
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.

Failure to participate with a Twitter post
2 participants