-
Notifications
You must be signed in to change notification settings - Fork 36
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
fix(headless, atomic): ensure components are enabled/disabled correctly when an invalid tab id is provided #4944
base: master
Are you sure you want to change the base?
Conversation
Pull Request ReportPR Title❌ Title should follow the conventional commit spec: Example: Live demo linksBundle Size
|
...less/src/controllers/core/search-parameter-manager/headless-core-search-parameter-manager.ts
Show resolved
Hide resolved
if (!validateParams(engine, newParams)) { | ||
return; | ||
} |
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.
why remove the validation ?
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.
Not needed anymore, we fallback to the first tab automatically when an invalid tab value is provided.
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 validates the ENTIRE SearchParameters, not just the tab parameter no?
We shouldn't remove the validation, we should only if possible, remove the validation of tabs only.
packages/quantic/force-app/examples/main/lwc/exampleQuanticAriaLive/exampleQuanticAriaLive.html
Show resolved
Hide resolved
packages/headless/src/features/search-parameters/search-parameter-actions.ts
Show resolved
Hide resolved
packages/headless/src/features/search-parameters/search-parameter-actions.ts
Show resolved
Hide resolved
...src/controllers/core/search-parameter-manager/headless-core-search-parameter-manager.test.ts
Show resolved
Hide resolved
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.
Not sure I fully understand the scope of this, seems like there are changes that might "break" some things? See comments
@@ -84,6 +87,7 @@ export interface SearchParameters { | |||
|
|||
/** | |||
* The active tab id. | |||
* @deprecated restore the tab using the `restoreTab` action instead. |
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.
Why is the "Active tab id" in the SearchParameters
being deprecated and suggested to use the restoreTab
action?
These two things don't seem to do the same thing?
|
||
export const restoreTab = createAction( | ||
'searchParameters/restoreTab', | ||
(payload: string) => validatePayload(payload, requiredNonEmptyString) |
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.
I would either create a RestoreTabPayload
type, or name this something specific like tabId
.
Just payload: string
is not descriptive enough.
activateTabIfIdExists(state, id); | ||
updateActiveTab(id); |
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.
So we were essentially calling updateActiveTab(id)
twice?
Once through activateTabIfIdExists(state, id);
and once directly through updateActiveTab(id)
?
@@ -22,10 +22,9 @@ export const tabSetReducer = createReducer( | |||
const id = action.payload; | |||
activateTabIfIdExists(state, id); | |||
}) | |||
.addCase(restoreSearchParameters, (state, action) => { |
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.
So was this not used anywhere?
It's kinda weird that we can simply remove an action from a reducer and just be done with it?
packages/quantic/force-app/examples/main/lwc/exampleQuanticAriaLive/exampleQuanticAriaLive.html
Show resolved
Hide resolved
@@ -19,14 +19,6 @@ routes.forEach((route) => { | |||
.as('initial-results'); | |||
}); | |||
|
|||
it('should add the tab search parameter with the default value', () => { |
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.
Why exactly is this being changed?
dispatch(registerTab({id, expression})); | ||
|
||
const isFirstTab = Object.keys(engine.state.tabSet).length === 1; | ||
if (isFirstTab) { | ||
initialState.isActive = true; |
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.
Won't this create the situation if you originally load with a tab in the URL state t=something
that the first tab will be triggered as active, and then afterwards when the urlManager does its thing that the real tab we want will get selected?
if (!validateParams(engine, newParams)) { | ||
return; | ||
} |
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 validates the ENTIRE SearchParameters, not just the tab parameter no?
We shouldn't remove the validation, we should only if possible, remove the validation of tabs only.
This PR ensures that when providing an invalid tab value, the active tab correctly falls back to the first available tab, with the tab-specific components enabled/disabled based on which tab is active.
https://coveord.atlassian.net/browse/KIT-3945