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

notion: rollup data only populating first entry #631

Closed
JeromeFitz opened this issue May 14, 2022 · 1 comment · Fixed by #632
Closed

notion: rollup data only populating first entry #631

JeromeFitz opened this issue May 14, 2022 · 1 comment · Fixed by #632

Comments

@JeromeFitz
Copy link
Owner

Seems to be a breaking change (to @jeromefitz/notion consider the entire thing is a hack, it's this repo's responsibility to adapt heh) in how Relation/Rollups pass data to one another:

ref: https://www.notion.so/releases/2022-05-03

For each Rollup/Relation, get its data by mocking its Notion Type one-by-one on the getTypes request instead of passing all at once. Then return the newly created array by its zero index.

Sure there is a better way, however, this will get us the fix we need short-term:

./packages/notion/src/utils/getTypes/rollup.ts

Before

const rollup = (data: any) => {
  return _sortBy(_map(data?.rollup?.array, (item) => getTypes[item.type](item)))
}

After

const rollup = (data: any) =>
  _sortBy(
    _map(data?.rollup?.array, (item) =>
      _map(item[item?.type], (itemData) =>
        getTypes[item?.type]({
          type: item?.type,
          [item?.type]: [itemData],
        })
      )
    )
  )[0]

lulz types would probably help. but with Notion's revamp in their SDK that will not come back for a bit.

Will be updated in canary version and verified for @jeromefitz/notion after some ⚽

@kodiakhq kodiakhq bot closed this as completed in #632 May 14, 2022
kodiakhq bot added a commit that referenced this issue May 14, 2022
**🎉 New Packages**
- `@jeromefitz/eslint-config`
- `@jeromefitz/lint-staged`
- `@jeromefitz/prettier-config`
- `@jeromefitz/tsconfig`

**🔥 Deprecated Packages**
- `@jeromefitz/codestyle`

**⬆️ Upgraded Packages**
- `@types/[email protected]`
- `@typescript-eslint/[email protected]`
- `@typescript-eslint/[email protected]`
- `[email protected]`
- `[email protected]`
- `husky@8`
- `[email protected]`
- `mantine/[email protected]`
- `[email protected]`
- `[email protected]`

**🚑 Hotfix**
- `@jeromefitz/notion` rollup
- `stitches` react18

**👷🏻 CI**
- Bump to 20 minutes for GitHub Actions


Closes #631
@JeromeFitz
Copy link
Owner Author

Well, with the benefit of hindsight making this a .flat() rather than [0] would be cleaner and more correct with ever changing data sourcing.

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 a pull request may close this issue.

1 participant