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: encode in abstractlazilyencodablesection not returning updated string #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ankitonetrust
Copy link

encode method in abstractlazilyencodablesection is not returning updated gpp string as dirty was set to false always

@ankitonetrust ankitonetrust force-pushed the gpp-string-creation-fix-master branch from 91136b8 to 76324c1 Compare January 25, 2025 05:11
@ankitonetrust ankitonetrust force-pushed the gpp-string-creation-fix-master branch from 76324c1 to 04c7b30 Compare January 25, 2025 05:13
@@ -242,6 +242,7 @@ export class GppModel {
let sectionName = Sections.SECTION_ORDER[i];
if (sections.has(sectionName)) {
let section = sections.get(sectionName);
section.setIsDirty(true);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ankitonetrust - Please use the same method in all the places where isDirty is getting set directly. I suggest using a new method setIsDirty in GppModel, which will be responsible for setting the isDirty flag and syncing the same flag in AbstractLazilyEncodableSection as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @dev-spandey there is no dependency for isDirty in AbstractLazilyEncodableSection other than encode method and the same file takes care of setting isDirty false.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ankitonetrust I've been doing a little digging and I think to avoid the issue this change causes with the decoding is to move this line of code to line 114 of this same file. That way it only gets set for the specific task of setting field values, which was described in the original bug.

@kamdishantanu
Copy link

Is there any timeline for this fix to go live? This is a critical one.

@gilluminate
Copy link

This fix does solve the original issue in my testing, but has potential implications for TC strings when TCF is included. I've submitted a separate bug for that issue that seems, at least partially, related to this issue. #79

@@ -242,6 +242,7 @@ export class GppModel {
let sectionName = Sections.SECTION_ORDER[i];
if (sections.has(sectionName)) {
let section = sections.get(sectionName);
section.setIsDirty(true);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ankitonetrust I've been doing a little digging and I think to avoid the issue this change causes with the decoding is to move this line of code to line 114 of this same file. That way it only gets set for the specific task of setting field values, which was described in the original bug.

Copy link
Collaborator

@HeinzBaumann HeinzBaumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good.

@gilluminate
Copy link

@HeinzBaumann this still needs my change request or it will continue to break the decode

@ankitonetrust
Copy link
Author

ankitonetrust commented Feb 21, 2025

@HeinzBaumann this still needs my change request or it will continue to break the decode

@gilluminate so basically your PR(#80) is going to fix the TCF related issue even without applying your change request of moving "section.setIsDirty(true)" to line 114.
I have verified this, I am getting Decoded string and related section data do match.
SetFieldValue() might call multiple times and not necessary to set dirty at this point. This PR is Good to merge.

@gilluminate
Copy link

@ankitonetrust In my testing, with #80 applied and this PR applied as is, the TCF string being generated is an invalid string altogether (plugging it in to the decoder at https://iabgpp.com throws an error "DecodingError: Unable to decode TcfEuV2PublisherPurposesSegment 'YAAAAAAA'")

I do see the point of not wanting to call it multiple times, but the fix in it's current state appears to still cause problems for the TCF string

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.

7 participants