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

[Vue] add lazyInitSingleton function to lazily initialize singleton stores #18656

Merged
merged 1 commit into from Jan 19, 2022

Conversation

diosmosis
Copy link
Member

Description:

Stores are singletons that can fetch data upon construction. This is helpful since it means components that use them don't have to manually initiate the fetch. However doing it this way can mean a lot of unneeded AJAX requests. The lazyInitSingleton function initializes a singleton upon first use so we only issue the AJAX requests when a store is used, without requiring components manually initialize them.

This is used in some of the sites manager PRs and some upcoming tag manager PRs.

Review

@diosmosis diosmosis added the Needs Review PRs that need a code review label Jan 19, 2022
@diosmosis diosmosis added this to the 4.7.0 milestone Jan 19, 2022
@sgiehl sgiehl modified the milestones: 4.7.0, 4.8.0 Jan 19, 2022
Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

Code looks fine. Guess we will see if it works as expected once it is in use somewhere

@sgiehl sgiehl removed the Needs Review PRs that need a code review label Jan 19, 2022
@sgiehl sgiehl merged commit ded3042 into 4.x-dev Jan 19, 2022
@sgiehl sgiehl deleted the vue-lazy-init-singleton branch January 19, 2022 16:16
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.

None yet

2 participants