Fix bug where >2 links causes duplicates on page re-rendering#1
Open
xenithorb wants to merge 1 commit into
Open
Fix bug where >2 links causes duplicates on page re-rendering#1xenithorb wants to merge 1 commit into
xenithorb wants to merge 1 commit into
Conversation
- Prior to this fix, any task object that had greater-than 2 links would duplicate n-1 of those links every time the page rendered. I made an assumption that it had something to do with Preact duplicating based on passing the entire `link` object to `key=` and it seems to work simply by removing the `key=` attribute altogether. - Also removed the unused `i` parameter
Author
|
Full disclosure: I have really no actual idea why it was duplicating links in the first place and merely got lucky with this patch. I'm not a JS developer and don't understand the code very well to really understand what was happening at the Preact level for it to duplicate link items. I do know that the data object in localStorage was fine, so it seems to be a rendering issue only. |
Author
|
You should be able to replicate with this JSON: {
"group_categories": [
{
"title_group": "Heading",
"categories": [
{
"tasks": [
{
"explications": "This area will start to duplicate links after a re-render",
"links": [
{
"text": "Google",
"type": "tools",
"path": "https://google.com"
},
{
"text": "Github",
"type": "link",
"path": "https://github.com"
},
{
"text": "Gitlab",
"type": "link",
"path": "https://gitlab.com"
}
],
"title": "Duplicate links after >2"
}
],
"title": "Task title"
}
]
}
],
"name": "Test checklist for duplicate links"
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I made an assumption that it had something to do with Preact duplicating based on passing the entire
linkobject tokey=and it seems to work simply by removing thekey=attribute altogether.iparameter