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

Add common props at _app.js level with caching functionality #1

Open
developerKumar opened this issue Jun 15, 2022 · 0 comments
Open
Assignees
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@developerKumar
Copy link
Owner

developerKumar commented Jun 15, 2022

We should be able to access props at _app.js level, it can be declared as

`
const { fetchMediaDataFromCMS } = require('./service/mediaData.service');

module.exports = () => ({
'/_app': [{ key: 'mediaPosts', data: fetchMediaDataFromCMS }],
});
`

Also, if same function is called by another page let's say

`const { fetchMediaDataFromCMS } = require('./service/mediaData.service');

module.exports = () => ({
'/2021/[id]': [{ key: 'mediaPosts', data: fetchMediaDataFromCMS }],
'/2022/[id]': [{ key: 'mediaPosts', data: fetchMediaDataFromCMS }],
'/_app': [{ key: 'mediaPosts', data: fetchMediaDataFromCMS }],
});
`

then, it should load the data for other pages from cache of the library, should not call the same function to evaluate again and again.

@developerKumar developerKumar pinned this issue Jun 15, 2022
@developerKumar developerKumar added the enhancement New feature or request label Jun 15, 2022
@developerKumar developerKumar self-assigned this Jun 15, 2022
@developerKumar developerKumar unpinned this issue Jun 15, 2022
@developerKumar developerKumar added the duplicate This issue or pull request already exists label Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant