fix: update uicore, replace and implement mui search input from uicore#867
fix: update uicore, replace and implement mui search input from uicore#867
Conversation
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
📝 WalkthroughWalkthroughReplaces a local Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
package.json (1)
100-111: Sync the React typings with the runtime versions.
reactandreact-domare bumped to 17.x here, but@types/react(line 50) and@types/react-dom(line 150) remain pinned to 16.x. For react@17 runtime, the type definitions should use@17.xto keep the type surface aligned with the shipped runtime. Either update both type packages to match the runtime version or remove them if they are no longer consumed.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package.json` around lines 100 - 111, The package.json lists react and react-dom at ^17.0.0 but the type packages `@types/react` and `@types/react-dom` are still at 16.x; update the type packages to match React 17 (e.g., set `@types/react` and `@types/react-dom` to ^17.0.0) or remove them if types are not consumed, and then run your package manager to reinstall; look for the `@types/react` and `@types/react-dom` entries to update.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/select-page-template-dialog/index.js`:
- Line 20: The import path for SearchInput is invalid in
openstack-uicore-foundation@5.0.3; replace the external import with a supported
component or a local implementation: either import the package's public search
component (e.g., FreeTextSearch from the library's inputs export) and update all
uses of SearchInput in this file to the new component name, or create a local
SearchInput component and import it from a relative path (e.g., ./SearchInput)
and ensure the component API matches how this file uses SearchInput. Target the
import statement and all references to SearchInput in this module (the import
line and usages in SelectPageTemplateDialog) when applying the fix.
In `@src/pages/sponsors-global/form-templates/add-form-template-item-popup.js`:
- Around line 68-70: The search handler handleOnSearch currently calls
getInventoryItems(searchTerm, currentPage, perPage, order, orderDir) which can
return empty results if the user is on a later page; change the flow to reset
pagination to page 1 when a new search term is applied by setting the current
page state to 1 and calling getInventoryItems with page=1 (i.e., use 1 instead
of currentPage) so the search always starts from the first page; update any
related state setter (e.g., setCurrentPage) and ensure getInventoryItems uses
the provided page argument.
In `@src/pages/sponsors-global/form-templates/form-template-list-page.js`:
- Around line 105-113: handleSearch currently calls getFormTemplates with the
existing currentPage which can leave the user on a later page and hide new
search results; update handleSearch to pass DEFAULT_CURRENT_PAGE instead of
currentPage so new searches always start at the first page (modify the call in
handleSearch to use DEFAULT_CURRENT_PAGE, keeping other args: perPage, order,
orderDir, hideArchived).
In
`@src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/add-sponsor-form-template-popup/index.js`:
- Around line 101-110: The search handler handleOnSearch should reset pagination
before fetching results to avoid requesting a non-existent page; update
handleOnSearch to set the current page to 1 (e.g., call setCurrentPage(1) or
pass 1 as the page arg) and then call getSponsorForms(searchTerm, 1, perPage,
order, orderDir, false, sponsorshipTypeIds) so new searches always start from
the first page.
---
Nitpick comments:
In `@package.json`:
- Around line 100-111: The package.json lists react and react-dom at ^17.0.0 but
the type packages `@types/react` and `@types/react-dom` are still at 16.x; update
the type packages to match React 17 (e.g., set `@types/react` and `@types/react-dom`
to ^17.0.0) or remove them if types are not consumed, and then run your package
manager to reinstall; look for the `@types/react` and `@types/react-dom` entries to
update.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7d9398ba-c9bc-4d37-9ab5-b5c4ed62af81
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (24)
package.jsonsrc/components/mui/search-input.jssrc/components/select-page-template-dialog/index.jssrc/pages/sponsors-global/form-templates/add-form-template-item-popup.jssrc/pages/sponsors-global/form-templates/form-template-from-duplicate-popup.jssrc/pages/sponsors-global/form-templates/form-template-list-page.jssrc/pages/sponsors-global/inventory/inventory-list-page.jssrc/pages/sponsors-global/page-templates/page-template-list-page.jssrc/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-add-item-from-inventory-popup.jssrc/pages/sponsors/sponsor-forms-list-page/components/global-template/select-templates-dialog.jssrc/pages/sponsors/sponsor-forms-list-page/index.jssrc/pages/sponsors/sponsor-list-page.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-badge-scans/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/cart-view.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-cart-tab/components/select-form-dialog/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/add-sponsor-form-template-popup/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/manage-items/sponsor-form-item-from-inventory.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/manage-items/sponsor-forms-manage-items.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/components/add-sponsor-page-template-popup/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-pages-tab/index.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-purchases-tab/index.jssrc/pages/sponsors/sponsor-users-list-page/index.jssrc/pages/sponsors/sponsor-users-list-per-sponsor/index.js
💤 Files with no reviewable changes (1)
- src/components/mui/search-input.js
| } from "@mui/material"; | ||
| import CloseIcon from "@mui/icons-material/Close"; | ||
| import SearchInput from "../mui/search-input"; | ||
| import SearchInput from "openstack-uicore-foundation/lib/components/mui/search-input"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python - <<'PY'
import io
import json
import tarfile
import urllib.parse
import urllib.request
name = "openstack-uicore-foundation"
version = "5.0.3"
encoded = urllib.parse.quote(name, safe="")
meta_url = f"https://registry.npmjs.org/{encoded}/{version}"
with urllib.request.urlopen(meta_url) as resp:
meta = json.load(resp)
print("main:", meta.get("main"))
print("module:", meta.get("module"))
print("exports:", json.dumps(meta.get("exports"), indent=2, sort_keys=True))
with urllib.request.urlopen(meta["dist"]["tarball"]) as resp:
blob = resp.read()
with tarfile.open(fileobj=io.BytesIO(blob), mode="r:gz") as tar:
names = sorted(
n for n in tar.getnames()
if "search-input" in n.lower()
)
print("\nPublished search-input paths:")
for name in names:
print(name)
targets = {
"package/lib/components/mui/search-input.js",
"package/lib/components/mui/search-input/index.js",
}
print("\nTarget path published:", any(n in targets for n in names))
PYRepository: fntechgit/summit-admin
Length of output: 2648
🌐 Web query:
openstack-uicore-foundation 5.0.3 SearchInput component public API documentation
💡 Result:
I couldn’t find any exported/public React component named SearchInput in openstack-uicore-foundation (including around the lib/components/inputs and lib/components listings I inspected). (app.unpkg.com)
What does exist in the public build is a search-related component named FreeTextSearch:
- Built file:
lib/components/free-text-search.js(app.unpkg.com) - You can browse other input components here:
lib/components/inputs/(app.unpkg.com)
Also, version 5.0.3 is present on UNPKG as a selectable/latest version for this package, so if you specifically need 5.0.3, you can switch the UNPKG version selector to 5.0.3 and then open the same paths (e.g., lib/components/free-text-search.js) to see the exact public API for that version. (app.unpkg.com)
Citations:
- 1: https://app.unpkg.com/openstack-uicore-foundation%404.2.22/files/lib/components/inputs
- 2: https://app.unpkg.com/openstack-uicore-foundation%404.2.22/files/lib/components/free-text-search.js
- 3: https://app.unpkg.com/openstack-uicore-foundation%404.2.22/files/lib/components/inputs
- 4: https://app.unpkg.com/openstack-uicore-foundation%404.2.22/files/lib/components/inputs/stepped-select.js.map
🏁 Script executed:
# Search for SearchInput imports across the codebase to understand the pattern
rg "SearchInput" --type js --type ts -B 2 -A 2 | head -100Repository: fntechgit/summit-admin
Length of output: 9342
🏁 Script executed:
# Check package.json for the dependency
rg "openstack-uicore-foundation" --type jsonRepository: fntechgit/summit-admin
Length of output: 122
🏁 Script executed:
# Search for local SearchInput components
fd -t f "search-input" src/components/Repository: fntechgit/summit-admin
Length of output: 48
🏁 Script executed:
# Check if src/components/mui/search-input exists
ls -la src/components/mui/search-input* 2>/dev/null || echo "Not found in local structure"Repository: fntechgit/summit-admin
Length of output: 94
🏁 Script executed:
# Search for all local SearchInput definitions or exports
ast-grep --pattern 'export.*SearchInput'Repository: fntechgit/summit-admin
Length of output: 48
🏁 Script executed:
# Check package-lock.json or yarn.lock to see actual installed structure
ls -la | grep -E "package-lock|yarn.lock"Repository: fntechgit/summit-admin
Length of output: 128
🏁 Script executed:
# Search git history for when SearchInput imports were added
git log --oneline --all -S "openstack-uicore-foundation/lib/components/mui/search-input" | head -20Repository: fntechgit/summit-admin
Length of output: 152
🏁 Script executed:
# Check if maybe there's a dist or build output with this file
find . -path ./node_modules -prune -o -type f -name "*search-input*" -print 2>/dev/null | head -20Repository: fntechgit/summit-admin
Length of output: 48
🏁 Script executed:
# Extract openstack-uicore-foundation entry from yarn.lock
rg -A 10 '"openstack-uicore-foundation@' yarn.lock | head -50Repository: fntechgit/summit-admin
Length of output: 48
🏁 Script executed:
# Also check if there's a .d.ts or types definition that might export SearchInput
fd -t f "\.(d\.ts|ts)$" | xargs rg -l "SearchInput" 2>/dev/null | head -10Repository: fntechgit/summit-admin
Length of output: 772
This import path does not exist in openstack-uicore-foundation@5.0.3.
Line 20 imports from openstack-uicore-foundation/lib/components/mui/search-input, but web search of the published v5.0.3 package shows no SearchInput component in the lib/components/mui/ directory. The package provides other components (e.g., FreeTextSearch, input components in lib/components/inputs/), but this specific path is not a documented or supported export. No local fallback component exists either. Either switch to a confirmed public export from the package, or if a SearchInput component is needed, create or import it from a local source.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/components/select-page-template-dialog/index.js` at line 20, The import
path for SearchInput is invalid in openstack-uicore-foundation@5.0.3; replace
the external import with a supported component or a local implementation: either
import the package's public search component (e.g., FreeTextSearch from the
library's inputs export) and update all uses of SearchInput in this file to the
new component name, or create a local SearchInput component and import it from a
relative path (e.g., ./SearchInput) and ensure the component API matches how
this file uses SearchInput. Target the import statement and all references to
SearchInput in this module (the import line and usages in
SelectPageTemplateDialog) when applying the fix.
src/pages/sponsors-global/form-templates/add-form-template-item-popup.js
Show resolved
Hide resolved
...sors/sponsor-page/tabs/sponsor-forms-tab/components/add-sponsor-form-template-popup/index.js
Show resolved
Hide resolved
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/add-sponsor-form-template-popup/index.js (1)
104-113: Keep page-size argument consistent in search fetch.Line [108] uses
perPage, while initial load/sort/pagination in this component all useFIVE_PER_PAGE. Using the same constant here avoids inconsistent result sizes from shared state leakage.Suggested change
const handleOnSearch = (searchTerm) => { getSponsorForms( searchTerm, DEFAULT_CURRENT_PAGE, - perPage, + FIVE_PER_PAGE, order, orderDir, false, sponsorshipTypeIds ); };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/add-sponsor-form-template-popup/index.js` around lines 104 - 113, The search handler handleOnSearch currently calls getSponsorForms with the variable perPage causing inconsistent page sizes; change the page-size argument to the shared constant FIVE_PER_PAGE (i.e., call getSponsorForms(searchTerm, DEFAULT_CURRENT_PAGE, FIVE_PER_PAGE, order, orderDir, false, sponsorshipTypeIds)) so it matches initial load/sort/pagination and avoid perPage/state leakage; also scan other calls to getSponsorForms in this component to ensure they uniformly use FIVE_PER_PAGE.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/add-sponsor-form-template-popup/index.js`:
- Around line 104-113: The search handler handleOnSearch currently calls
getSponsorForms with the variable perPage causing inconsistent page sizes;
change the page-size argument to the shared constant FIVE_PER_PAGE (i.e., call
getSponsorForms(searchTerm, DEFAULT_CURRENT_PAGE, FIVE_PER_PAGE, order,
orderDir, false, sponsorshipTypeIds)) so it matches initial load/sort/pagination
and avoid perPage/state leakage; also scan other calls to getSponsorForms in
this component to ensure they uniformly use FIVE_PER_PAGE.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 565aa9ae-9bbe-4a37-b8c5-ba87c96fb342
📒 Files selected for processing (3)
src/pages/sponsors-global/form-templates/add-form-template-item-popup.jssrc/pages/sponsors-global/form-templates/form-template-list-page.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/add-sponsor-form-template-popup/index.js
🚧 Files skipped from review as they are similar to previous changes (2)
- src/pages/sponsors-global/form-templates/form-template-list-page.js
- src/pages/sponsors-global/form-templates/add-form-template-item-popup.js
ref: https://app.clickup.com/t/86b84rhkb
Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com
Summary by CodeRabbit
Chores
Refactor