PromucFlow_constructor/app/client
vivek-appsmith abc9c71c3d
fix: API editor query parameters not auto-updating URL (#40133)
# API Editor Query Parameters URL Auto-Update Fix

## Issue
When adding or editing query parameters in the API editor, the URL
wasn't automatically being updated to reflect these changes. This
creates a disconnect between the parameters in the Params tab and the
actual URL being used, as reported in issue #40045.

## Fix
Implemented proper synchronization between query parameters and the URL
in the API editor using a two-pronged approach:

1. **Component-level solution** with React hooks:
- Added a `useSyncParamsToPath` hook that handles bidirectional
synchronization
   - Ensures sync happens on component mount and when values change
   - Prevents update loops by checking if changes are needed

2. **Redux saga enhancement**:
- Enhanced `syncApiParamsSaga` to ensure the action model is updated
when params change
   - Provides a failsafe at the data layer in addition to the UI layer

These changes ensure:
- When query parameters are modified in the Params tab, the URL now
updates automatically
- When the URL is modified with query parameters, they are correctly
extracted to the Params tab
- Synchronization happens proactively rather than just reactively

## Changes
- Added new React hook for bidirectional synchronization
- Updated `syncApiParamsSaga` to handle API action data updates
- Addressed potential edge cases like empty parameters and update loops

## Test Strategy
No new test cases were added for the following reasons:
- This fix primarily addresses UI synchronization between two components
- The fix is easily verified through manual testing
- The functionality is already covered by existing integration tests for
the API editor
- The changes are focused on visual state synchronization rather than
core business logic
- The bug is easily reproduced and fixed by the UI components working
together correctly

## Related Issue
Fixes #40045

## Automation

/ok-to-test tags="@tag.Datasource"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/14332565088>
> Commit: 6de39d58842493a4eb514278a7c6e8dc458dc635
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14332565088&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Datasource`
> Spec:
> <hr>Tue, 08 Apr 2025 12:29:38 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Improved synchronization between URL parameters and form inputs,
ensuring real-time, consistent updates during user interactions.
- Enhanced the API configuration interface by automatically reflecting
changes to action parameters for a smoother experience.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Aman Agarwal <aman@appsmith.com>
2025-04-11 16:43:26 +05:30
..
.husky ci: Add pre push hook to not allow ee changes in ce (#35276) 2024-07-30 12:11:27 +05:30
.yarn
config fix: sourcemaps (#39301) 2025-02-16 20:05:50 +03:00
cypress feat: reset table when infinite scroll is turned on (#40066) 2025-04-10 03:58:15 -07:00
docker/templates chore: add grafana faro sdk (CE) (#38301) 2024-12-26 10:37:41 +05:30
generators
packages chore: move ai chat from help to bottom bar (#40175) 2025-04-09 10:02:53 +05:30
public chore: add maximum-scale to avoid zoom on inputs in iOS (#40171) 2025-04-08 19:16:31 +05:30
scripts chore: Eject CRA (#39264) 2025-02-14 14:24:41 +05:30
src fix: API editor query parameters not auto-updating URL (#40133) 2025-04-11 16:43:26 +05:30
test chore: Removing feature flag for app IDE new entity explorer (#39912) 2025-04-03 12:07:24 +05:30
typings
.babelrc chore: Eject CRA (#39264) 2025-02-14 14:24:41 +05:30
.dockerignore
.editorconfig
.eslintrc.base.json feat: add react-compiler eslint plugin (#37139) 2024-10-31 16:40:18 +01:00
.eslintrc.js fix: change appsmith alias (#35349) 2024-08-06 17:52:22 +03:00
.fork-ts-checkerrc
.gitignore
.lintstagedrc.json
.nvmrc
.prettierignore
.prettierrc
.sentryclirc
.yarnrc.yml
build.sh fix: sourcemaps (#39301) 2025-02-16 20:05:50 +03:00
cypress_ci_custom.config.ts chore: change snapshot package (#35867) 2024-09-12 11:09:42 +03:00
cypress_ci_hosted.config.ts chore: change snapshot package (#35867) 2024-09-12 11:09:42 +03:00
cypress_ci.config.ts chore: change snapshot package (#35867) 2024-09-12 11:09:42 +03:00
cypress-add-tags.js
cypress.config.ts chore: change snapshot package (#35867) 2024-09-12 11:09:42 +03:00
download-assets.js
jest.config.js chore: add grafana faro sdk (CE) (#38301) 2024-12-26 10:37:41 +05:30
knip.json chore: Eject CRA (#39264) 2025-02-14 14:24:41 +05:30
package.json fix: storybook build and small improvements for stories (#39936) 2025-03-26 18:04:30 +03:00
README.md
README.old.md
start-caddy.sh
start-https.sh chore: convert consolidated api etag to a weak one (#38939) 2025-01-31 16:35:20 +05:30
tailwind.config.js
tsconfig.json chore: upgrade typescript to 5.4 (#35181) 2024-07-30 16:15:48 +02:00
tsconfig.path.json chore: rename old ADS package (#35517) 2024-08-08 15:55:00 +03:00
vercel.json
yarn.lock chore: ab test simple git reset in git status api (#39959) 2025-04-01 21:36:08 +05:30

Appsmith Client

This project was bootstrapped with Create React App.

For details on setting up your development machine, please refer to the Setup Guide