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

Bug - Loop Item tag not always visible in Loop Item block #1608

Merged
merged 8 commits into from
Jan 7, 2025

Conversation

iansvo
Copy link
Collaborator

@iansvo iansvo commented Dec 18, 2024

@tomusborne
Copy link
Owner

This seems to break the blocks inside of the Looper.

broken-query.mp4

I'm also not 100% sure why the changes in the PR would fix the mentioned issue? Any context there?

@iansvo
Copy link
Collaborator Author

iansvo commented Dec 20, 2024

This issue prevents the Loop Item tag from being hidden because the loop doesn't see anything. I had previously set up some fallback context, but the hasResolvedData check when rendering caused it to not get used.

So by doing this, loopItemsContext always wraps the output, no matter if the query is empty or not. This ensures there's always a loopItem, loopIndex, and previewId for loop items, even if the query is empty.

I made a tweak just now to make sure the currentPostId was being used here, just in case. With this change, I'm seeing everything work as expected. Can you have another look and confirm?

@tomusborne
Copy link
Owner

I'm still having issues selecting blocks with this PR.

To replicate:

  1. Add Query
  2. Start blank
  3. Select Loop item and add empty text
  4. Select something else and try to select text again

@iansvo
Copy link
Collaborator Author

iansvo commented Jan 2, 2025

@tomusborne I made a small tweak and it looks like we're in business. It appears there was a dep missing and I moved this other variable out of the memo for better stability. In my testing I'm no longer seeing this issue as you mentioned after this change.

@tomusborne
Copy link
Owner

I'm still seeing weirdness here.

loop-weirdness.mp4

At this point I'm thinking maybe we should just always show the Loop Item/Index options and ditch the conditional visibility until another date.

@tomusborne tomusborne merged commit ab73ba0 into release/2.0.0 Jan 7, 2025
9 checks passed
@tomusborne tomusborne deleted the bug/loop-index branch January 7, 2025 15:41
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.

2 participants