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

Integrate Toolpad Core in Toolpad Studio runtime #4119

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

apedroferreira
Copy link
Member

@apedroferreira apedroferreira commented Sep 19, 2024

Closes #4060

  • Includes fix for only scrolling to selected elements in editor when needed (it was really disrupting UX)
  • Includes a first attempt for optional react-router-dom/AppProvider as it seems like it will be popular, but we can adjust it more
  • Adds sx prop to DashboardLayout

Missing:

  • Some responsive fixes
  • Update docs + mention and adjust them to react-router-dom/AppProvider if we include it
  • See if session works well, haven't tried with authentication yet

@apedroferreira apedroferreira added the core Infrastructure work going on behind the scenes label Sep 19, 2024
@apedroferreira apedroferreira self-assigned this Sep 19, 2024
@@ -270,6 +270,14 @@ if (import.meta.hot) {
: // load compiled
path.resolve(currentDirectory, '../exports'),
},
{
find: '@toolpad/core',
Copy link
Member Author

@apedroferreira apedroferreira Sep 19, 2024

Choose a reason for hiding this comment

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

I had to add an alias here to get @toolpad/core imports to work in Studio, not sure why it's not needed for @toolpad/studio-components for example, as those just worked?

Copy link
Member

Choose a reason for hiding this comment

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

pnpm installs the core build folder into studio node modules because of its package.json publishConfig.directory setting. During the core build command a package.json is generated in that build folder. the build folder is what gets published on npm.

The dev command of builds the sources into the build folder, but it doesn't copy the package.json. That's why module resolution doesn't work. You made it work by alisaing to the core main folder, which does have a package.json.

I added some commits that just call the copy command in the dev command. It's not perfect, it won't watch for changes to package.json, but at least it unblocks us in the PR.

@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels Sep 20, 2024
@Janpot
Copy link
Member

Janpot commented Sep 20, 2024

This horizontal scrolling is something to investigate:

Screen.Recording.2024-09-20.at.10.26.48.mov

@apedroferreira
Copy link
Member Author

This horizontal scrolling is something to investigate:

Yeah still fixing a few things.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Sep 20, 2024
return [
`import { ${name} } from '@toolpad/core/${name}';${
hasNextJsVersion
? `\nimport { ${name} } from '@toolpad/core/nextjs/${name}'; // Next.js`
: ''
}${
hasReactRouterDOMVersion
? `\nimport { ${name} } from '@toolpad/core/react-router-dom/${name}'; // react-router-dom`
Copy link
Member

@Janpot Janpot Sep 20, 2024

Choose a reason for hiding this comment

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

We don't support imports deeper than one level. This must be

import { AppProvider } from '@toolpad/core/react-router-dom'

cc @bharatkashyap same for nextjs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes PR: out-of-date The pull request has merge conflicts and can't be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

integrate Toolpad core into Toolpad studio runtime
2 participants