lifterlms icon indicating copy to clipboard operation
lifterlms copied to clipboard

The Access Plan Button Settings > Access Plan of the Access Plan Button Block can only display a maximum of 10 plans,

Open dominiquemariano opened this issue 2 years ago • 4 comments
trafficstars

Reproduction Steps

  1. Start with a fresh installation of WordPress and LifterLMS, with no course imports.
  2. Create two new courses in WordPress Dashboard > Courses.
  3. Create 6 access plans for each course.
  4. Create a third course.
  5. Drag and drop the Access Plan Button block in the content area of the third course.
  6. Under Access Plan Button Settings > Access Plan, you'll notice that only 10 access plans are listed.

Expected Behavior

All 12 access plans must show up.

Actual Behavior

Not all 12 access plans showed up. Only 10 did.

This issue has been recreated:

  • [x] Locally
  • [ ] On a staging site
  • [x] On a production website
  • [x] With only LifterLMS and a default theme

dominiquemariano avatar Sep 25 '23 12:09 dominiquemariano

I believe this limitation of the access plan count maximum was a performance consideration. I believe there may already be a workaround (filter or hook / gist) if someone wants to override the limit and take the performance hit. I'm ok with increasing the maximum if engineering sees it as not a significant performance tradeoff.

chrisbadgett avatar Sep 25 '23 13:09 chrisbadgett

Slack convo

actuallyakash avatar Sep 26 '23 06:09 actuallyakash

The problem is that the number of access plans that are going to populate the select is fetched via the rest api, which, by default, returns the first 10 items. https://github.com/gocodebox/lifterlms/blob/185e02878c7395e795b3763a501f645ea39bc8d7/src/blocks/access-plan-button/index.jsx#L38

This problem seems to affect all the new blocks that are using selects with data fetched via rest api.

We can fetch the last 100 items, but that would be a workaround. Maybe enough for now. The best would be, though, using a search box like the one we use in the Enrollment Visibility option: screenshot-20230927_133848_982188175

eri-trabiccolo avatar Sep 27 '23 11:09 eri-trabiccolo