Skip to content

Commit

Permalink
test: Try repeating code to pass tests (temp)
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Feb 8, 2024
1 parent 013b500 commit 3f04d20
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
10 changes: 9 additions & 1 deletion editor.planx.uk/src/@planx/components/FileUpload/Public.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,17 @@ const FileUpload: React.FC<Props> = (props) => {
);

const updatedRequestedFiles = () => {
// const { required, recommended, optional } = useStore
// .getState()
// .requestedFiles();

const { required, recommended, optional } = useStore
.getState()
.requestedFiles();
.computePassport().data?.[PASSPORT_REQUESTED_FILES_KEY] || {
required: [],
recommended: [],
optional: [],
};

return {
[PASSPORT_REQUESTED_FILES_KEY]: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,17 @@ const hasSlots = (userFile: UserFile): userFile is UserFileWithSlots =>
Boolean(userFile?.slots);

const getUpdatedRequestedFiles = (fileList: FileList) => {
// const { required, recommended, optional } = useStore
// .getState()
// .requestedFiles();

const { required, recommended, optional } = useStore
.getState()
.requestedFiles();
.computePassport().data?.[PASSPORT_REQUESTED_FILES_KEY] || {
required: [],
recommended: [],
optional: [],
};

return {
[PASSPORT_REQUESTED_FILES_KEY]: {
Expand Down
1 change: 1 addition & 0 deletions editor.planx.uk/src/pages/FlowEditor/lib/store/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ export const previewStore: StateCreator<
}
},

// TODO: Fix this!
requestedFiles: () => {
const { computePassport } = get();
const currentRequestedFiles =
Expand Down

0 comments on commit 3f04d20

Please sign in to comment.