[Bug] Refactor this function to not always return the same value.

Open
#406 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
typescript
Domain
frontend

Research direction

Locate the shouldShowForCurrentView function and inspect its callers and related view-filtering logic to determine the original intent of currentView. Check whether the callback should distinguish views or can be removed, then verify that the resulting behavior matches the expected visibility rules and does not always return the same value.

Written by the indexing model from the issue text.

Description

Bug Description

The intention of this function is not clear. Take a look.

  const shouldShowForCurrentView = useCallback(() => {
    if (!currentView) return true;
    
    // Show for all views
    return true;
  }, [currentView]);

Did you mean false in the if statement?

Steps to Reproduce

Take a look at the function and tell if there is any logic in it. What was the original intent?

Expected Behavior

Should return different values or this is not needed at all.

Browser and Version

Edge latest

AppFlowy Version(s)

0.15

Screenshots

No response

Logs and Console Output

No response

Additional Context

No response

Dominant language
TypeScript
Stars
354
Forks
186
Avg merge
1d 7h
Merged PRs (30d)
71

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AppFlowy-IO/AppFlowy-Web

All issues in AppFlowy-IO/AppFlowy-Web

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.