-
Notifications
You must be signed in to change notification settings - Fork 443
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
layers support in watch mode #1503
Conversation
// if path is "/x.svg", we just want "x" | ||
split := strings.Split(strings.TrimPrefix(r.URL.Path, "/"), ".") | ||
boardPath := strings.Join(split[:len(split)-1], ".") | ||
if boardPath != w.boardPath { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this check? Shouldn't we always render the requested board path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prevent duplication of compile requests on the initial load
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not clear to me how this accomplishes that. Can you elaborate? Also, fairly certain this is racey, I don't think you can modify w.boardPath
like that without putting it under a mutex as the compilation occurs in the background.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate?
I just figure on initial load it's already compiling (behavior before this PR). So I don't want to add another recompile on top of that
fairly certain this is racey
it calls requestCompile()
, which dodges races with channels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will address in another PR if needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't dodge the race. You can't modify a variable that's read in another goroutine without synchronization. The channel send merely guarantees that the compileLoop goroutine will run a compile at some point in the future, not that it isn't already running one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i did go install -race .
, then reran the manual test in the PR description, and it didn't say there was a race.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The race detector never produces false positives, but it does produce false negatives. It can't prove your program doesn't have races, only that it does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will look into this again later #1508
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
df103d8
to
11a4363
Compare
Let users develop multi-board diagrams in watch mode.
Example of clicking links to navigate in watch mode:
Kapture.2023-07-28.at.23.21.07.mp4
The back button doesn't work to update the board, at least on mac. I guess it doesn't trigger a page refresh for some reason, but this can be deferred.
closes #1176