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

Fix circular imports in forms package #368

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState, useRef, useEffect } from 'react';
import { useFormManagerStore } from '../../../store.js';
import styles from '../../formEditStyles.module.css';
import type { Pattern } from '@atj/forms';

interface MovePatternDropdownProps {
isFieldset: boolean;
Expand All @@ -27,7 +28,9 @@ const MovePatternDropdown: React.FC<MovePatternDropdownProps> = ({
const dropdownRef = useRef<HTMLDivElement>(null);
const buttonRef = useRef<HTMLButtonElement>(null);
const pages = useFormManagerStore(state =>
Object.values(state.session.form.patterns).filter(p => p.type === 'page')
Object.values<Pattern>(state.session.form.patterns).filter(
p => p.type === 'page'
)
);
const movePatternToPage = useFormManagerStore(state => state.movePattern);
const focusPatternId = useFormManagerStore(state => state.focus?.pattern.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import classNames from 'classnames';
import { useFormManagerStore } from '../../../store.js';
import MovePatternDropdown from './MovePatternDropdown.js';
import styles from '../../formEditStyles.module.css';
import type { Pattern } from '@atj/forms';

type PatternEditActionsProps = PropsWithChildren<{
children?: ReactElement;
Expand All @@ -19,7 +20,7 @@ export const PatternEditActions = ({ children }: PatternEditActionsProps) => {
state => state.focus?.pattern.type
);
const patterns = useFormManagerStore(state =>
Object.values(state.session.form.patterns)
Object.values<Pattern>(state.session.form.patterns)
);
const focusPatternId = useFormManagerStore(state => state.focus?.pattern.id);
const isPatternInFieldset = useMemo(() => {
Expand All @@ -34,10 +35,12 @@ export const PatternEditActions = ({ children }: PatternEditActionsProps) => {
copyPattern: state.copyPattern,
}));
const pages = useFormManagerStore(state =>
Object.values(state.session.form.patterns).filter(p => p.type === 'page')
Object.values<Pattern>(state.session.form.patterns).filter(
p => p.type === 'page'
)
);
const fieldsets = useFormManagerStore(state =>
Object.values(state.session.form.patterns).filter(
Object.values<Pattern>(state.session.form.patterns).filter(
p => p.type === 'fieldset'
)
);
Expand Down
5 changes: 5 additions & 0 deletions packages/forms/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { watch } from 'rollup';
import { builtinModules } from 'module';

import { nodeResolve } from '@rollup/plugin-node-resolve';
Expand Down Expand Up @@ -51,4 +52,8 @@ export default {
]),
];
})(),
watch: {
include: 'src/**/*.ts',
clearScreen: false,
},
};
Loading
Loading