Skip to content

Conversation

@snabela
Copy link
Member

@snabela snabela commented Oct 3, 2025

Note

Introduces SD-specific scrolling/ecommerce handlers and graphics API integration, plus a new WooCommerce field to pass parameters_settings_url to the configurator.

  • Frontend (TypeScript):
    • New file src/sd-specific.ts:
      • Implements graphics API client with caching and mappers for categories/products.
      • Adds scrolling API handlers: scrollingApiSetParameters and scrollingApiLoadMore for source graphics.
      • Provides SpecificECommerceApiActions overriding cart, sharing link, and scrolling behaviors.
      • Exposes specificECommerceApiActionsFactory and developmentUrlBuilderOptions.
  • WordPress (PHP):
    • Adds product meta field _parameters_settings_url; saves it and returns via get_product_data as query_params._parameters_settings_url.
  • Build/Config:
    • Update tsconfig.json to include src/sd-specific.ts.

Written by Cursor Bugbot for commit f6c3c36. This will update automatically on new commits. Configure here.

cursor[bot]

This comment was marked as outdated.

@snabela snabela force-pushed the task/SS-9019 branch 2 times, most recently from 6c313d2 to c7ce155 Compare October 3, 2025 16:36
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.


// map categories to items
const items: IScrollingApiItemTypeSelect[] = categories.map((p) => ({
item: "search:category:" + p.name,
Copy link

Choose a reason for hiding this comment

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

Bug: Category item prefix mismatch

Category items are returned with the prefix "search:category:" but the parsing logic checks for "category:". When a user selects a category from the returned items, the item value like "search:category:Foo" won't match the startsWith("category:") check, causing it to fall through to the else branch and be incorrectly treated as a search term instead of a category selection.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

$parameter_settings_url = sanitize_text_field(get_post_meta($product_id, '_parameters_settings_url', true));
if (!empty($parameter_settings_url)) {
$query_params = array();
$query_params['_parameters_settings_url'] = $parameter_settings_url;
Copy link

Choose a reason for hiding this comment

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

Bug: Wrong query parameter name for parameters settings URL

The query parameter key '_parameters_settings_url' includes a leading underscore, but the description on line 504 states the parameter should be "parameters_settings_url" (without underscore). If the configurator expects the parameter without the underscore prefix (as documented), this URL parameter will be ignored and the feature won't work as intended.

Fix in Cursor Fix in Web

result.items = result.items.concat(items);
}

console.log(result);
Copy link

Choose a reason for hiding this comment

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

Bug: Debug console.log statement left in production code

The console.log(result) statement logs all scrolling API results to the console on every call to returnAndMapCachedResults. Unlike the other console.log statements in the file which have TODO comments indicating they're placeholders for customization, this one appears to be leftover debug logging that will clutter the browser console in production.

Fix in Cursor Fix in Web

}

const base =
"https://test1.tarablooms.in/wp-json/custom/v1/graphic-components";
Copy link

Choose a reason for hiding this comment

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

Bug: Test server URL hardcoded instead of production URL

The API base URL uses test1.tarablooms.in (a test server), but the documentation comment on line 132 states it should fetch from tarablooms.in (production). This mismatch suggests the test URL was accidentally left in the code. In production, this could cause the graphics API integration to fail if the test server is not accessible or contains different data.

Fix in Cursor Fix in Web

},
}));
result.items = items;
}
Copy link

Choose a reason for hiding this comment

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

Bug: Categories duplicated on every pagination load more call

The returnAndMapCachedResults function always adds categories to the result items, but it's called by both scrollingApiSetParameters (initial load) and scrollingApiLoadMore (pagination). This causes categories to be included in every "load more" response, resulting in duplicate category items being shown to users on subsequent pages. Categories should only be included on the initial load, not when paginating through products.

Additional Locations (1)

Fix in Cursor Fix in Web

}

await fetchFromGraphicsApi(latestQuery, false);
return returnAndMapCachedResults();
Copy link

Choose a reason for hiding this comment

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

Bug: Race condition in shared state across async operations

The module-level variable latestQuery is modified and then used across an await boundary without protection. If multiple calls to scrollingApiSetParameters or scrollingApiLoadMore occur concurrently (e.g., rapid user input), one call could modify latestQuery while another is awaiting its fetch. When the first call resumes and executes returnAndMapCachedResults(), it accesses cachedResults[latestQuery] using the modified value, which may not exist in the cache yet, causing a TypeError.

Additional Locations (1)

Fix in Cursor Fix in Web

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