-
Notifications
You must be signed in to change notification settings - Fork 189
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
Sign Up Flow does not allow more than one blog URL regardless of instructions #3607
Comments
Hi, I'm still figuring out how Telescope works, but can I try to solve this issue? I can get multiple blogs validated if I comment out this error check at the top of the const validateBlog = async () => {
/* if (errors[name]) {
setFieldValue(selected, [], true); <--- Commenting out allows multiple blogs to be validated.
return;
} */
try {
setValidating(true);
controllerRef?.current?.abort();
controllerRef.current = new AbortController();
// Allow a list of URLs, separated by spaces
const urls = (values[name] as string).split(/ +/);
const response = await fetch(`${feedDiscoveryServiceUrl}`, {
signal: controllerRef.current?.signal,
method: 'post',
headers: {
Authorization: `bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(urls),
});
if (!response.ok) {
throw new Error(response.statusText);
}
const { feedUrls }: DiscoveredFeeds = await response.json();
if (feedUrls.length === 1) {
setFieldValue(selected, [feedUrls[0]], true);
}
setUrlError('');
setFieldValue(discovered, feedUrls);
} catch (err) {
console.error(err, 'Unable to discover feeds');
setUrlError('Unable to discover feeds');
setFieldValue(discovered, []);
} finally {
// eslint-disable-next-line require-atomic-updates
controllerRef.current = null;
setValidating(false);
}
}; The part I'm stuck on now is how to get rid of the error message that still appears in the text box after inputting two URLs. |
@alexsam29 |
I got it. So I found that The problem here is that it expects a string with a proper URL format. So obviously when you enter a space, it automatically detects that as an error. I've tried adjusting the validation to accommodate an array of URL strings, but the main problem with that is that the When I get rid of the URL validation schema, it gets parsed correctly but you obviously need some type of input validation. I think the solution here is to somehow return an array of string URLs from I'm currently thinking of ways to implement that potential solution. |
Finding the bug is always about 80% of the work done! Now you just have to figure out how to implement the solution. Nice work! 👍 |
Yep, that last 20% is always the most difficult. I also noticed that selecting multiple URLs for channels (YouTube/Twitch) has a similar function, but the same bug is not present. I looked at the validating schema here and the I haven't been able to come up with a implementation to my solution without having to change the way the blog URL is inputted. But if we do that, you lose UI consistency with the other sign-up sections. So my new solution would be to make the Let me know what you think. I have it working similar to the channel section, so I could make a PR to have it reviewed. |
What happened:
Sign up flow says I can add more than one URL feed by using spaces. I attempt this and there are errors, and I can't validate
What should have happened:
Either we allow two URLs or not. But instructions do not match the validation parameters we have set.
How to reproduce it (as precise as possible):
Sign up flow - > add two urls
Anything else we need to know?:
Environment:
The text was updated successfully, but these errors were encountered: