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

hotfix: data-items local variables #2780

Merged
merged 4 commits into from
Feb 6, 2025
Merged

Conversation

chrismclarke
Copy link
Member

@chrismclarke chrismclarke commented Feb 5, 2025

PR Checklist

  • PR title descriptive (can be used in release notes)

Description

Fix regression introduced by #2767 where data_items no longer passed outer local variables to inner items

Review Notes

Minimal reproduction of issue available at comp_data_items_debug_2

Should be broken on master but fixed in branch. Should also confirm original issue resolved

Dev Notes

I should have been a bit more careful when adding the additional variable that is meant to stay in sync with the templateRowMap, not realising that the rowMap was updated in multiple places not just the main processor. As part of this fix I checked the codebase for anywhere the templateRowMap was updated and tried to ensure the related templateRowMapValues was also.

A better solution might have been to only allow the templateRowMap to be set/updated from a method (not directly), and just using that method to ensure both values updated, however that would have been a larger refactor so not included at this moment. Alternatively the values could be created through some sort of getter/function, however it would require a level of memoizing or using computed signal in service to prevent repeated recalculation as it is accessed by every row processor.

I tried adding tests to capture the behaviour, however the code change is within the hackProcessRows method which is stubbed for testing so not easy to do. However the behaviour is captured within comp_data_items Example 3 (accessing completed_counter inside of items), so now that visual tests are back working the component sheet should pick up any future regression if visually tested.

I have also added some minor test updates to the template-action.service.spec that check the general case of the templateRowMapValues being updated (wouldn't have caught this specific issue but good to have for future ref)

Git Issues

Closes #2777

Screenshots/Videos

If useful, provide screenshot or capture to highlight main changes

@github-actions github-actions bot added the fix label Feb 5, 2025
@chrismclarke chrismclarke changed the title fix: data-items local variables hotfix: data-items local variables Feb 5, 2025
Copy link
Collaborator

@esmeetewinkel esmeetewinkel left a comment

Choose a reason for hiding this comment

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

Functional test passed on highlighted debug deployment sheet, as well as on plh_kids_kw deployment where the issue was first discovered.

Copy link
Collaborator

@jfmcquade jfmcquade left a comment

Choose a reason for hiding this comment

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

Looks good, the changes and explanation make sense

@esmeetewinkel esmeetewinkel merged commit d92b28c into master Feb 6, 2025
6 checks passed
@esmeetewinkel esmeetewinkel deleted the fix/data-items-outer-local branch February 6, 2025 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] ERROR: @local.filter not found
3 participants