You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TODO: Handle Error for Existing Branch on Word Submission #52
When a user submits a new word or edits an existing word in the dictionary, the system should check if the branch already exists before attempting to create a new branch. Currently, if a branch with the same name already exists, the submission process fails without providing a clear error message to the user.
Add a check in the submission process to verify if the branch already exists. (but this will assume that a fork has already been created before-hand)
If the branch exists, display a user-friendly error message indicating that the word already exists in the dictionary.
Provide guidance on how to proceed, such as editing the existing word instead of creating a new one.
Additional Notes:
Important to state that the proposed solution is pretty much me thinking out loud, I have some thought which really looks like it will change how/when we fork in order to address this in the way I am thinking about
Its also important to know how/when we fork too, I can shed more lights on this
This issue has been temporarily addressed though in #66; which fulfils the action of removing the current reference and proceeding to recreating it. That logic is handled here
* Temporary workaround for handling deletion of existing reference/branch
*/
constdata=awaitresponse.json();
$isWordSubmitLoading.set(false);
if(
response.status===422&&
data.message.includes("Reference already exists")
){
if(
confirm(
"It appears you have an existing reference for the current word, do you wish to clear that reference?",
)
){
$isWordSubmitLoading.set(true);
constresponse=awaitfetch("/api/dictionary",{
method: "DELETE",
body: formData,
});
if(response.status===200){
$isWordSubmitLoading.set(false);
alert(
"Reference cleared successfully! Kindly publish your contribution again!",
);
}
}else{
router.push("/editor");
}
Working on this issue would require some thoughts around the current state of the branch....
What is the current state of existing branch?
is it a Branch for a word contribution that is still pending approval? If it's this, then we'll definitely want to resume the branch to modify pending contribution - and this means we will have to have a jargons Editor resume contribution session - a new session
is it a Branch for a word contribution that is approved? If it's this, then we will want to delete, as this might be a branch that wasn't deleted after contribution PR got merged
...and a little more thoughts... So I'm curious, how would you approach this?
"Reference cleared successfully! Kindly publish your contribution again!",
);
}
The condition in Line 176 is always false because the response code of the successful DELETE request is 204. This logic, however, will be rewritten as part of the issue
Activity
feat: implement temporary existing branch error handling (relates to #52
chore: implement feedback/nits from beta testing (#66)
FabianEilts commentedon Oct 24, 2025
@babblebey Would like to work on this issue. Could you please assign it to me?
babblebey commentedon Oct 24, 2025
Hey @FabianEilts,
This issue has been temporarily addressed though in #66; which fulfils the action of removing the current reference and proceeding to recreating it. That logic is handled here
jargons.dev/src/components/islands/word-editor.jsx
Lines 157 to 184 in 7ea2fca
Working on this issue would require some thoughts around the current state of the branch....
...and a little more thoughts... So I'm curious, how would you approach this?
FabianEilts commentedon Oct 25, 2025
Regarding pending approval:
Is it possible to offer the user the option to edit the existing word and add a new commit to the PR?
If a branch for a word contribution is approved, then we can delete it, as you suggested.
Also found a bug at the current workaround.
jargons.dev/src/components/islands/word-editor.jsx
Lines 171 to 181 in 7ea2fca
The condition in Line 176 is always false because the response code of the successful DELETE request is 204. This logic, however, will be rewritten as part of the issue