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

Suggestion: Implement a reset function for f:cycle #412

Open
Scopestyle opened this issue Oct 22, 2018 · 1 comment
Open

Suggestion: Implement a reset function for f:cycle #412

Scopestyle opened this issue Oct 22, 2018 · 1 comment
Assignees

Comments

@Scopestyle
Copy link

I hope this is the right place to share this.

Problem
By design f:cycle stores its state in a static property, which keeps it state for the whole php/rendering process. This means that when there are 2 modules using f:cycle on the page, the cycle never resets itself.

For example in a situation where 20 elements are being cycled:

<f:cycle values="{0: '1', 1: '2', 2: '3', 3: '4', 4: '5', 5: '6', 6: '7', 7: '8', 8: '9', 9: '10', 10: '11', 11: '12', 12: '13', 13: '14', 14: '15', 15: '16', 16: '17', 17: '18', 18: '19', 19: '20'}" as="i">

If a module on the page has 10 items, adding a 2nd module on the page starts the cycle at 11. Which might not be the desired outcome.

Suggestion
I would like to propose a reset="1" function where instead of saving the cycle state, it resets at every new implementation on the page.

@lolli42
Copy link
Member

lolli42 commented Nov 24, 2023

I'd actually say the 'leaking' state is a bug, but I'm not sure if we can change this without being breaking.

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

No branches or pull requests

3 participants