-
Notifications
You must be signed in to change notification settings - Fork 81
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
Using the library with the react-diff-viewer sandbox <https://8rhv2q.csb.app/> found different behaviour #220
Comments
Could please paste your old and new code directly here, so I can have more debugging work to reproduce and identify the problem |
|
The code of the sandbox can be found here: Sanbox URL |
@otakustay Did you have a chance to reproduce the issue? Could you share more hints? |
@otakustay Any news on the ability to reproduce the issue? Or you don't recognize it as an issue? |
Sorry for the sever delay, this issue is related to how we compute diff from source text using I've changed the sandbox, adding an option object to const diffText = formatLines(
diffLines(oldText.value, newText.value, {newlineIsToken: true}),
{context: 3},
); Note the This for sure is not correct, and I believe the problem lies inside the This is not a render issue for |
It's also weird to me that the const Diff = require('diff');
const a = `{
"prop_a":[
{
"firstname": "Andrea",
"lastname": "Chieppa"
},
{
"firstname": "Mario",
"lastname": "Rossi"
},
{
"new_tag": "new"
}
]
}`;
const b = `{
"prop_a":[
{
"firstname": "Mario",
"lastname": "Rossi"
},
{
"firstname": "Guido",
"lastname": "Bianchi"
},
{
"new_tag": "new"
}
]
}`;
const patch = Diff.createPatch(
'a.txt',
a,
b,
undefined,
undefined,
{
newlineIsToken: true
}
); This results:
Don't know where the issue is currently |
@otakustay I try to diff the 2 following sample json in the react-diff-viewer sandbox https://8rhv2q.csb.app/ .
As in the attached picture:
I would expect to identify the pattern:
{
"firstname": "Mario",
"lastname": "Rossi"
}
as repeated and identical, while the library compare line per line in this case.
Note that just adding the following new element in the array:
{
"new_tag": "new";
}
the library identifies the correct repeated and identical item.
Any suggestions? Did I miss some configuration parameters to let the repeated element properly identified as identical in the 2 input variables?
{
"firstname": "Mario",
"lastname": "Rossi"
}
Regards,
Giampietro
The source code from the sandbox is:
The text was updated successfully, but these errors were encountered: