Skip to content

fix(themes): send the shown sort option when the store default sort is disabled - #1044

Merged
sallainternalbot[bot] merged 3 commits into
masterfrom
bugfix/RI-23763-sort-not-applied-when-single-option
Sep 9, 2026
Merged

sallainternalbot[bot] merged 3 commits into
masterfrom
bugfix/RI-23763-sort-not-applied-when-single-option

Conversation

@eslamoo

@eslamoo eslamoo commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

  • Bug fix

What is the current behaviour? (You can also link to an open issue here)

  • The sort option shown in the dropdown never reaches the first products request. is_selected is derived only from the ?sort= query param, so when a merchant disables the store's default sort (ourSuggest) no option is marked selected, salla-products-list receives no sort-by, and the list loads in the API default order while the dropdown shows something else. With a single enabled option the change event can never fire, so the mismatch is permanent.

What is the new behaviour? (You can also link to the ticket here)

  • When no option is marked selected and the first option is not ourSuggest, the page renders sort-by from that option so the first request carries the sort the dropdown shows.
Case sort-by First request vs today
First option is ourSuggest "" no sort param unchanged
ourSuggest disabled, 1 option that option &sort=<option> fixed
ourSuggest disabled, 2+ options first option &sort=<first> fixed
URL has ?sort= "" &sort=<from URL> unchanged
No sort options "" no sort param unchanged
  • Only stores that disabled ourSuggest change at all. The ourSuggest exclusion is deliberate: the API default is byte-identical to an explicit sort=ourSuggest, so emitting it would add a query param to every store's first request for no behavioural gain.
  • The "no option selected" condition is what keeps ?sort= working. After a shopper picks a sort the theme adds ?sort= via replaceState; on reload the backend marks that option selected, the fallback stays empty, and componentWillLoad (this.sortBy || searchParams.get('sort')) reads the URL instead of being overridden by the attribute.

Does this PR introduce a breaking change?

  • No

Screenshots (If appropriate)

When the merchant disables the default sort, the backend marks no option
as selected and salla-products-list receives no sort-by, so the first
request falls back to the store default instead of the enabled option.
Render sort-by from the first enabled option when nothing is selected.
@sallainternalbot
sallainternalbot Bot marked this pull request as draft September 9, 2026 13:02
Lists with more than one option keep sending no sort, so the API default
applies until the shopper picks a sort from the dropdown.
@codacy-production

Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@eslamoo eslamoo changed the title fix(themes): pass the initial sort option to the first products request fix(themes): pass the sort option to the first products request when only one is enabled Sep 9, 2026
@eslamoo
eslamoo marked this pull request as ready for review September 9, 2026 13:35
Covers lists with more than one enabled option too, not just a single one.
Stores whose first option is still ourSuggest send an unchanged request,
and an explicit ?sort= keeps priority because the backend marks that
option selected.
@eslamoo eslamoo changed the title fix(themes): pass the sort option to the first products request when only one is enabled fix(themes): send the shown sort option when the store default sort is disabled Sep 9, 2026
@ashrafreda

Copy link
Copy Markdown
Collaborator

/merge

@sallainternalbot

Copy link
Copy Markdown
Contributor

⏳ Enqueued for Merge

Your pull request has been added to the merge queue. It will be merged automatically once it reaches the front of the queue ✅


🔄 Queue Status

🚦 Queue

The queue is empty. Good luck!

🧬 PR's Dependencies

├── sallaapp/theme-raed#1044

@sallainternalbot

Copy link
Copy Markdown
Contributor

🔄 Merge In Progress

This pull request has reached the front of the queue and is now being processed for merge.

@sallainternalbot
sallainternalbot Bot merged commit 266e71b into master Sep 9, 2026
1 check passed
@sallainternalbot
sallainternalbot Bot deleted the bugfix/RI-23763-sort-not-applied-when-single-option branch September 9, 2026 14:22
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