-
Notifications
You must be signed in to change notification settings - Fork 0
Bugfix/fix auth bootstrap bounce #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
4278fc9
chore: standardize package workflows and ci/cd configuration
Zaiidmo 1f1f0fc
ops: added sonarqube_mcp-instructions
Zaiidmo abd24dd
chore: standardize npm scripts (lint, format, typecheck, test, build,…
Zaiidmo 60174d4
chore: Standardize ESLint and Prettier configs with best practices
Zaiidmo 5849509
chore: added comprehensive changesets for release automation
Zaiidmo 242268e
docs: add standardized instruction files structure
Zaiidmo 32fbed8
refactor: move instruction files to .github/instructions/
Zaiidmo 01c6680
Merge branch 'develop' of github.com:CISCODE-MA/AuthKit-UI into develop
Zaiidmo 21e78f1
ops: UPDATED publish workflow and dependabot PR limits
Zaiidmo 6afb8bc
ops (ci): standardize publish validation and dependabot across all pa…
Zaiidmo 47bb5fb
security: added CODEOWNER file for branches security
Zaiidmo a0ec3aa
ops: updated relese check workflow#
Zaiidmo 5bcecc4
ci: update release check workflow
Zaiidmo 74328f8
ops: updated release check jobs ]
Zaiidmo c8e5d3c
feat(auth): add dynamic signup fields and custom endpoints
SAAD-MOUMOU b9e29d8
refactor(ui): cleanup imports and formatting in auth pages
SAAD-MOUMOU fad2355
fix(auth): remove accessToken from bootstrap useEffect deps to preven…
SAAD-MOUMOU 12563c4
fix: resolve merge conflicts with develop (scripts + vitest versions)
SAAD-MOUMOU f4f745c
fix: resolve lint errors, test failures and add eslint + prettier dev…
SAAD-MOUMOU 0d0fb37
chore: bump version to 1.0.15
SAAD-MOUMOU 2e96948
test: enhance coverage for AuthKit-UI + fix typecheck and test:cov sc…
SAAD-MOUMOU b7293e7
fix: replace deprecated JSX.Element with React.ReactElement in AuthPr…
SAAD-MOUMOU File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| "@ciscode/ui-authentication-kit": minor | ||
| --- | ||
|
|
||
| ## Summary | ||
| Added SonarQube MCP integration instructions for code quality analysis and automated quality gates | ||
|
|
||
| ## Changes | ||
| - Updated package configuration and workflows | ||
| - Enhanced code quality and automation tooling | ||
| - Improved CI/CD integration and monitoring capabilities | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * @CISCODE-MA/devops |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: npm | ||
| directory: "/" | ||
| schedule: | ||
| interval: monthly | ||
| open-pull-requests-limit: 1 | ||
| groups: | ||
| npm-dependencies: | ||
| patterns: | ||
| - "*" | ||
| assignees: | ||
| - CISCODE-MA/cloud-devops | ||
| labels: | ||
| - "dependencies" | ||
| - "npm" | ||
| commit-message: | ||
| prefix: "chore(deps)" | ||
| include: "scope" | ||
| rebase-strategy: auto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,273 @@ | ||
| # Bugfix Instructions - UI Kit Module | ||
|
|
||
| > **Last Updated**: February 2026 | ||
|
|
||
| --- | ||
|
|
||
| ## 🔍 Bug Investigation Process | ||
|
|
||
| ### Phase 1: Reproduce | ||
|
|
||
| **Before writing any code:** | ||
|
|
||
| 1. **Understand the issue** - Read bug report carefully | ||
| 2. **Reproduce locally** - Create minimal reproduction | ||
| 3. **Verify it's a bug** - Not expected behavior | ||
| 4. **Check browser compatibility** - Test across browsers | ||
|
|
||
| **Create failing test FIRST:** | ||
|
|
||
| ```typescript | ||
| describe('Bug: Button not disabled when loading', () => { | ||
| it('should disable button during loading', () => { | ||
| render(<Button isLoading>Click</Button>); | ||
|
|
||
| // This SHOULD pass but currently FAILS | ||
| expect(screen.getByRole('button')).toBeDisabled(); | ||
| }); | ||
| }); | ||
| ``` | ||
|
|
||
| ### Phase 2: Identify Root Cause | ||
|
|
||
| **Investigation tools:** | ||
|
|
||
| - **React DevTools** - Inspect component tree | ||
| - **Console logs** - Debug state changes | ||
| - **Debugger** - Breakpoints in code | ||
| - **Browser DevTools** - Check DOM/styles | ||
|
|
||
| ```typescript | ||
| // Debug component props/state | ||
| useEffect(() => { | ||
| console.log('Props changed:', props); | ||
| }, [props]); | ||
| ``` | ||
|
|
||
| ### Phase 3: Understand Impact | ||
|
|
||
| **Critical questions:** | ||
|
|
||
| - Which browsers affected? | ||
| - Does it break accessibility? | ||
| - Is there a workaround? | ||
| - Does it affect other components? | ||
|
|
||
| --- | ||
|
|
||
| ## 🐛 Common Bug Categories | ||
|
|
||
| ### 1. State Management Issues | ||
|
|
||
| | Bug Type | Symptoms | Solution | | ||
| | --------------------- | ---------------------- | --------------------------- | | ||
| | **Stale closure** | Old values in callback | Update dependencies | | ||
| | **Infinite loop** | Component re-renders | Fix useEffect dependencies | | ||
| | **Lost state** | State resets unexpectedly| Check component key | | ||
|
|
||
| **Example fix:** | ||
|
|
||
| ```typescript | ||
| // ❌ BUG - Stale closure | ||
| const [count, setCount] = useState(0); | ||
|
|
||
| useEffect(() => { | ||
| const timer = setInterval(() => { | ||
| setCount(count + 1); // ❌ Always uses initial count | ||
| }, 1000); | ||
| return () => clearInterval(timer); | ||
| }, []); // Missing count dependency | ||
|
|
||
| // ✅ FIX - Functional update | ||
| useEffect(() => { | ||
| const timer = setInterval(() => { | ||
| setCount(prev => prev + 1); // ✅ Uses current count | ||
| }, 1000); | ||
| return () => clearInterval(timer); | ||
| }, []); | ||
| ``` | ||
|
|
||
| ### 2. useEffect Issues | ||
|
|
||
| | Bug Type | Symptoms | Solution | | ||
| | --------------------- | --------------------- | --------------------------- | | ||
| | **Memory leak** | Performance degrades | Add cleanup function | | ||
| | **Missing cleanup** | Side effects persist | Return cleanup | | ||
| | **Wrong dependencies**| Unexpected behavior | Fix dependency array | | ||
|
|
||
| **Example fix:** | ||
|
|
||
| ```typescript | ||
| // ❌ BUG - No cleanup | ||
| useEffect(() => { | ||
| const subscription = api.subscribe(handleData); | ||
| }, []); | ||
|
|
||
| // ✅ FIX - Cleanup on unmount | ||
| useEffect(() => { | ||
| const subscription = api.subscribe(handleData); | ||
| return () => subscription.unsubscribe(); | ||
| }, []); | ||
| ``` | ||
|
|
||
| ### 3. Event Handler Issues | ||
|
|
||
| | Bug Type | Symptoms | Solution | | ||
| | --------------------- | --------------------- | --------------------------- | | ||
| | **Handler not called**| Click doesn't work | Check event binding | | ||
| | **Multiple calls** | Handler fires twice | Remove duplicate listeners | | ||
| | **Wrong event** | Unexpected behavior | Use correct event type | | ||
|
|
||
| **Example fix:** | ||
|
|
||
| ```typescript | ||
| // ❌ BUG - Handler called immediately | ||
| <button onClick={handleClick()}> // ❌ Calls on render | ||
|
|
||
| // ✅ FIX - Pass function reference | ||
| <button onClick={handleClick}> // ✅ Calls on click | ||
| <button onClick={() => handleClick(arg)}> // ✅ With arguments | ||
| ``` | ||
|
|
||
| ### 4. Rendering Issues | ||
|
|
||
| | Bug Type | Symptoms | Solution | | ||
| | --------------------- | --------------------- | --------------------------- | | ||
| | **Conditional render**| Component disappears | Fix condition logic | | ||
| | **Key prop** | Wrong items update | Use stable unique keys | | ||
| | **Forced re-render** | Performance issues | Memoize expensive calcs | | ||
|
|
||
| **Example fix:** | ||
|
|
||
| ```typescript | ||
| // ❌ BUG - Index as key | ||
| {items.map((item, index) => ( | ||
| <div key={index}>{item.name}</div> | ||
| ))} | ||
|
|
||
| // ✅ FIX - Unique stable key | ||
| {items.map(item => ( | ||
| <div key={item.id}>{item.name}</div> | ||
| ))} | ||
| ``` | ||
|
|
||
| ### 5. Accessibility Bugs | ||
|
|
||
| | Bug Type | Symptoms | Solution | | ||
| | --------------------- | --------------------- | --------------------------- | | ||
| | **Missing ARIA** | Screen reader issues | Add ARIA attributes | | ||
| | **No keyboard nav** | Can't use keyboard | Add keyboard handlers | | ||
| | **Poor contrast** | Hard to read | Fix colors | | ||
|
|
||
| **Example fix:** | ||
|
|
||
| ```typescript | ||
| // ❌ BUG - Div as button (not accessible) | ||
| <div onClick={handleClick}> | ||
| Submit | ||
| </div> | ||
|
|
||
| // ✅ FIX - Proper button element | ||
| <button onClick={handleClick} aria-label="Submit form"> | ||
| Submit | ||
| </button> | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🔧 Fix Implementation Process | ||
|
|
||
| ### 1. Write Failing Test | ||
|
|
||
| ```typescript | ||
| it('should fix the bug', async () => { | ||
| render(<Component />); | ||
|
|
||
| await userEvent.click(screen.getByRole('button')); | ||
|
|
||
| expect(screen.getByText(/expected/i)).toBeInTheDocument(); | ||
| }); | ||
| ``` | ||
|
|
||
| ### 2. Implement Fix | ||
|
|
||
| ```typescript | ||
| // Fix the component | ||
| export function Component() { | ||
| // Corrected implementation | ||
| return <div>Fixed!</div>; | ||
| } | ||
| ``` | ||
|
|
||
| ### 3. Verify Test Passes | ||
|
|
||
| ```bash | ||
| npm test -- Component.test.tsx | ||
| ``` | ||
|
|
||
| ### 4. Test in Browser | ||
|
|
||
| ```bash | ||
| npm run dev | ||
| # Manually test the fix | ||
| ``` | ||
|
|
||
| ### 5. Update Documentation | ||
|
|
||
| ```typescript | ||
| /** | ||
| * Component that was buggy | ||
| * | ||
| * @fixed v1.2.3 - Fixed click handler issue | ||
| */ | ||
| export function Component(props: Props): JSX.Element | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## ⚠️ Common Gotchas | ||
|
|
||
| ### 1. Prop Mutation | ||
|
|
||
| ```typescript | ||
| // ❌ Bug - Mutating props | ||
| const sortedItems = props.items.sort(); // Mutates! | ||
|
|
||
| // ✅ Fix - Create copy | ||
| const sortedItems = [...props.items].sort(); | ||
| ``` | ||
|
|
||
| ### 2. Incorrect Comparison | ||
|
|
||
| ```typescript | ||
| // ❌ Bug - Object comparison | ||
| if (user === prevUser) { } // Always false (different references) | ||
|
|
||
| // ✅ Fix - Compare values | ||
| if (user.id === prevUser.id) { } | ||
| ``` | ||
|
|
||
| ### 3. Missing Null Checks | ||
|
|
||
| ```typescript | ||
| // ❌ Bug - No null check | ||
| return user.profile.name; // Crashes if profile is null | ||
|
|
||
| // ✅ Fix - Optional chaining | ||
| return user?.profile?.name ?? 'Unknown'; | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 📋 Bugfix Checklist | ||
|
|
||
| - [ ] Bug reproduced in browser | ||
| - [ ] Failing test created | ||
| - [ ] Root cause identified | ||
| - [ ] Fix implemented | ||
| - [ ] All tests pass | ||
| - [ ] Manually tested in browser | ||
| - [ ] Accessibility verified | ||
| - [ ] Documentation updated | ||
| - [ ] CHANGELOG updated | ||
| - [ ] No regression |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changeset describes only SonarQube/CI tooling, but this PR also adds consumer-facing API changes (e.g., new
AuthConfigPropsfields and a newuseCanAnyhook). Please update the changeset to reflect the actual public-facing changes so release notes are accurate.