Skip to content

#22 resolve rearrange tabs #23

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shekharmetre
Copy link

@shekharmetre shekharmetre commented Feb 25, 2025

No description provided.

Copy link

vercel bot commented Feb 25, 2025

@Kalbhairu is attempting to deploy a commit to the harsh's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Feb 25, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sealnotes ❌ Failed (Inspect) Feb 25, 2025 2:59pm

@harshsbhat
Copy link
Owner

It has build errors. Can you resolve them? @shekharmetre

./src/app/[...slug]/client.tsx:315:31
Type error: Argument of type '{ title: string; description: string; } | undefined' is not assignable to parameter of type '{ title: string; description: string; }'.
Type 'undefined' is not assignable to type '{ title: string; description: string; }'.
313 | const newArray = [...getValues("tabs")];
314 | const [moveditem] = newArray.splice(activeTab, 1);
> 315 | newArray.splice(index, 0, moveditem);
| ^
316 | setValue("tabs", newArray, { shouldDirty: true });
317 | setIsDirty((prev) => [...prev, false]);
318 | };
 ELIFECYCLE  Command failed with exit code 1.
Error: Command "pnpm run build" exited with 1

@shekharmetre
Copy link
Author

const handleDrop = (index: number) => {
const newArray = [...getValues("tabs")];

// Ensure activeTab is within bounds
if (activeTab == null || activeTab < 0 || activeTab >= newArray.length) {
return;
}

const [moveditem] = newArray.splice(activeTab, 1);

// Ensure moveditem is not undefined before inserting
if (!moveditem) {
return;
}

newArray.splice(index, 0, moveditem);
setValue("tabs", newArray, { shouldDirty: true });
setIsDirty((prev) => [...prev, false]);
};
u can try this one

@harshsbhat
Copy link
Owner

why are you not pushing it on the same branch? @shekharmetre

@shekharmetre
Copy link
Author

shekharmetre commented Feb 25, 2025

Are you referring to the main branch?

@shekharmetre
Copy link
Author

I am a frontend developer and haven't learned Redis yet. In the future, if developers like me want to contribute, I can create a dummy access setup specifically for frontend developers. What do you think?

@shekharmetre
Copy link
Author

Please create an issue, and I will take care of it.

@harshsbhat
Copy link
Owner

Why do we need a different issue? Just push the changes to this branch.

@shekharmetre
Copy link
Author

shekharmetre commented Feb 25, 2025

I think the issue is that getValues should return an initial value at index 0. If activeTab or handleDrop's index is undefined, it might be causing problems because you can't rearrange a single element. If this isn't the issue, let me know, and I'll investigate further. My current problem is that I'm not connected to Redis, whereas you are using Redis in your setup. Give me some time, and I'll work on solving it i have to understand lil bit reddis .

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 this pull request may close these issues.

3 participants