Git Product home page Git Product logo

next-data-hooks's Issues

Error when attaching a second DataHook

It should be possible to attach more than just one datahook I believe. But I get an error. Can just one DataHook be delivered to getStaticProps()?

export const getStaticProps: GetStaticProps = async (context) => {
  const dataHooksProps = await getDataHooksProps({
    context,
    dataHooks: ParagraphExample.dataHooks,
  });

  const dataHooksProps2 = await getDataHooksProps({
    context,
    dataHooks: BlogPost.dataHooks,
  });

  

  return {
    props: { ...dataHooksProps, dataHooksProps2 },
  };

I also tried:
dataHooks: [ParagraphExample.dataHooks, BlogPost.dataHooks].

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update typescript-eslint monorepo to v8.2.0 (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/test.yml
  • actions/checkout v3
  • actions/setup-node v3
  • codecov/codecov-action v3
npm
package.json
  • @babel/core 7.25.2
  • @babel/node 7.25.0
  • @babel/plugin-transform-runtime 7.24.7
  • @babel/preset-env 7.25.3
  • @babel/preset-react 7.24.7
  • @babel/preset-typescript 7.24.7
  • @ricokahler/exec 1.1.0
  • @rollup/plugin-babel 5.3.1
  • @rollup/plugin-node-resolve 13.3.0
  • @types/common-tags 1.8.4
  • @types/jest 29.5.12
  • @types/react 18.3.3
  • @types/react-dom 18.3.0
  • @types/react-test-renderer 18.3.0
  • @types/webpack 5.28.5
  • @typescript-eslint/eslint-plugin 8.1.0
  • @typescript-eslint/parser 8.1.0
  • @babel/eslint-parser 7.25.1
  • common-tags 1.8.2
  • create-next-app 13.4.19
  • eslint 8.57.0
  • eslint-config-react-app 7.0.1
  • eslint-plugin-flowtype 8.0.3
  • eslint-plugin-import 2.29.1
  • eslint-plugin-jsx-a11y 6.9.0
  • eslint-plugin-react 7.35.0
  • eslint-plugin-react-hooks 4.6.2
  • folder-hash 4.0.4
  • jest 28.1.3
  • next 13.4.19
  • prettier 2.8.8
  • react 18.3.1
  • react-dom 18.3.1
  • react-error-boundary 3.1.4
  • react-test-renderer 18.3.1
  • rollup 2.79.1
  • typescript 4.9.5
  • react ^16.8 || ^17 || ^18.0.0
  • next ^9.3 || ^10 || ^11.0.0 || ^12.0.0 || ^13.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

generate .dataHooks and getStaticProps with the babel plugin

Component.dataHooks always is an array of the data hooks from other components and the createDataHook function.

similarly getStaticProps, unless extra static props are desired, is also the same every time you write it: calling getDataHooksProps.

couldn't both of these be generated by the babel plugin? from my little experience from using babel, this shouldn't be too tricky to make, and it would reduce a lot of extra code that is copied from page to page, and eliminates the chance of missing a step.

the only issue here would be how to know weather to use getStaticProps or getServerSideProps, since you can't tell that from the hook usage themselves.

i'd like to try to implement this, maybe as an optional thing you need to enable. what are your thoughts?

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Not working with latest Next

Great project! Tried to use it with my project, however, it was failing with an error Error: Could not find NextDataHooksContext. Ensure NextDataHooksProvider is configured correctly.

Tried to debug and ended up cloning the repo and running the example. First run, works (next 10.0.1), then proceeded to update Next to 10.1.3 (latest). Hit the exception

Parameter in Call

Thanks for the lib.
I wanted to implement this feature but had been confronted with 2 mature issues, that let me stick to simple function in the comp file, that will be called in a static function within a page.

  1. The useHooks do not carry payloads… this is important to handle specific calls for specific instances of the same component in the same page.

  2. The hook body is more like a static independent function without context… or index. This makes it hard to bind the data two the components if there are more than just one.
    Are there any plans to modify or add payload features in the future ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.