Skip to content

Conversation

@johnny-quesada-developer
Copy link
Contributor

@johnny-quesada-developer johnny-quesada-developer commented Oct 30, 2025

What is this PR doing?

This PR refactors the AppConfigContext to isolate updates and stop global re-renders.
It forces components to subscribe only to the specific configuration keys they depend on, eliminating unnecessary re-renders and improving overall performance.
It also introduces the isAppConfigLoaded flag to stabilize initialization and prevent UI flickers.

Additionally, it removes excessive mocking from our test suite to improve reliability and ensure tests reflect real behavior.
This change lays the groundwork for future low-code/no-code configuration flows, where the AppConfigContext will become more dynamic and require granular state updates.

How should this be manually tested?

What are the relevant tickets?

A maintainer will add this ticket number.

Resolves VIDSOL-281

Checklist

[x] Branch is based on develop (not main).
[ ] Resolves a Known Issue.
[ ] If yes, did you remove the item from the docs/KNOWN_ISSUES.md?
[ ] Resolves an item reported in Issues.
If yes, which issue? Issue Number?

@johnny-quesada-developer johnny-quesada-developer changed the base branch from main to johnny/vidsol-280-unit-test-fixes-and-refinements October 30, 2025 16:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@johnny-quesada-developer johnny-quesada-developer force-pushed the johnny/vidsol-VIDSOL-281-refactor-AppConfigContext-for-scoped-reactivity-and-stable-rests branch from a4c1660 to 57d7614 Compare October 31, 2025 09:59
@johnny-quesada-developer johnny-quesada-developer force-pushed the johnny/vidsol-280-unit-test-fixes-and-refinements branch from a0d05c8 to 6d8ac7f Compare October 31, 2025 11:19
@johnny-quesada-developer johnny-quesada-developer force-pushed the johnny/vidsol-VIDSOL-281-refactor-AppConfigContext-for-scoped-reactivity-and-stable-rests branch from 57d7614 to b10a7fc Compare October 31, 2025 11:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 83 out of 84 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@johnny-quesada-developer johnny-quesada-developer force-pushed the johnny/vidsol-VIDSOL-281-refactor-AppConfigContext-for-scoped-reactivity-and-stable-rests branch 4 times, most recently from 77170d3 to 55e2440 Compare October 31, 2025 13:18
Copy link
Contributor

@OscarFava OscarFava left a comment

Choose a reason for hiding this comment

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

Amazing work! Nice refactor to make testing/Contexts more readable and stable.

PD: There are missing changes regarding ../../../hooks/ I suggest changing it in another PR.
For example, changing:
import useIsSmallViewport from '../../../hooks/useIsSmallViewport';

@johnny-quesada-developer johnny-quesada-developer force-pushed the johnny/vidsol-280-unit-test-fixes-and-refinements branch from 6d8ac7f to d3f10b6 Compare November 3, 2025 14:33
- using granular context for app configuration... avoid re-renders and isolate logic

- adding reusable provider wrappers for unit test

- removing a bunch of mocks in our unit test... mocking our own code downgrades the quality of the test
@johnny-quesada-developer johnny-quesada-developer force-pushed the johnny/vidsol-VIDSOL-281-refactor-AppConfigContext-for-scoped-reactivity-and-stable-rests branch from 55e2440 to 74ac49d Compare November 3, 2025 14:46
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 3, 2025

});
});

function render(ui: ReactElement, options?: SessionProviderWrapperOptions) {
Copy link
Contributor

Choose a reason for hiding this comment

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

could you please help explain if there is any particular reason (besides personal preference) to use the function notation instead of the arrow function notation we've been using throughout the project? I'd prefer to stick to the arrow notation please as to remain consistent; otherwise, we'll have to go in and change everything

Copy link
Contributor Author

@johnny-quesada-developer johnny-quesada-developer Nov 3, 2025

Choose a reason for hiding this comment

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

Hi of course @behei-vonage ,

Actually, I didn’t use the function notation out of personal preference, but because of hoisting. I’m declaring the function as a utility at the end of the file, but I want it to be available everywhere within the file. With an arrow function, I can’t guarantee that it will always be available, but with a regular function declaration, I can. Using the function keyword is more convenient in this case because I don’t even need to worry about where the render call is or anything like that.

With function key:
image

With arrow function:
image

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for the explanation, @johnny-quesada-developer 🙏
in that case, will ensuring that the function is declared before its used be sufficient? I think it's important to stick to a particular way in a reference app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants