Skip to content
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 usePreference should throw an error when used outside a <Configurable> context #9537

Merged
merged 1 commit into from Dec 22, 2023

Conversation

arimet
Copy link
Contributor

@arimet arimet commented Dec 20, 2023

Resolve #9526

@arimet arimet added the RFR Ready For Review label Dec 20, 2023
@arimet arimet self-assigned this Dec 20, 2023
@@ -218,3 +218,8 @@ export const I18n = () => {
};

export const NotInContext = () => <TextBlock />;

export const usePreferenceNotInConfigurable = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export const usePreferenceNotInConfigurable = () => {
export const UsePreferenceOutsideConfigurable = () => {

@@ -58,7 +58,7 @@ const TextBlockEditor = () => {
);
};
```
This hook is only used within a Configurable component.
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is redundant with the information given above. IMO it's not necessary to add it.

@@ -218,3 +218,8 @@ export const I18n = () => {
};

export const NotInContext = () => <TextBlock />;

export const usePreferenceNotInConfigurable = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export const usePreferenceNotInConfigurable = () => {
export const UsePreferenceNotInConfigurable = () => {

Not sure it's necessary to create a story for this corner-case though...

@djhi djhi merged commit ab2e448 into master Dec 22, 2023
11 checks passed
@djhi djhi deleted the fix/usePreferences branch December 22, 2023 14:38
@djhi djhi added this to the 4.16.5 milestone Dec 22, 2023
@slax57 slax57 changed the title Feat(usePreference): Throw an error if used outisde right context Fix usePreference should throw an error when used outside a <Configurable> context Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

usePreferences behavior is unexpected when used outside of Configurable
4 participants